summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmview.cpp
blob: 90e47e690fcb7f36ae6d94775bd1e29eb682654b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
**************************************************************************
                                 description
                             --------------------
    copyright            : (C) 2000-2001 by Andreas Zehender
    email                : zehender@kde.org
**************************************************************************

**************************************************************************
*                                                                        *
*  This program is free software; you can redistribute it and/or modify  *
*  it under the terms of the GNU General Public License as published by  *
*  the Free Software Foundation; either version 2 of the License, or     *
*  (at your option) any later version.                                   *
*                                                                        *
**************************************************************************/


#include <tqprinter.h>
#include <tqpainter.h>
#include <tqsplitter.h>
#include <layout.h>
#include <tqlabel.h>
#include <kconfig.h>
#include <kdialog.h>
#include <klocale.h>

#include <stdio.h>

// application specific includes
#include "pmview.h"
#include "pmpart.h"
#include "pmtreeview.h"
#include "pmdialogview.h"
#include "pmglview.h"

PMView::PMView( PMPart* part, TQWidget* parent, const char* name )
      : TQWidget( parent, name )
{
   setBackgroundMode( PaletteBase );

   TQVBoxLayout* layout = new TQVBoxLayout( this );
   m_pMainSplitter = new TQSplitter( Qt::Horizontal, this, "MainSplitter" );
   m_pTreeEditSplitter = new TQSplitter( Qt::Vertical, m_pMainSplitter,
                                        "TreeEditSplitter" );

   
   m_pTreeView = new PMTreeView( part, m_pTreeEditSplitter, "TreeView" );
   m_pTreeView->show( );
   
   m_pDialogView = new PMDialogView( part, m_pTreeEditSplitter, "EditView" );
   m_pDialogView->show( );

   
   TQWidget* glArea = new TQWidget( m_pMainSplitter, "GLArea" );
   glArea->show( );
   PMGLView* gl;
   
   TQGridLayout* topLayout = new TQGridLayout( glArea, 2, 2, 1, 1 );
   gl = new PMGLView( part, PMGLView::PMViewPosZ, glArea );
   topLayout->addWidget( gl, 0, 0 );
   gl = new PMGLView( part, PMGLView::PMViewPosX, glArea );
   topLayout->addWidget( gl, 0, 1 );
   gl = new PMGLView( part, PMGLView::PMViewNegY, glArea );
   topLayout->addWidget( gl, 1, 0 );
   gl = new PMGLView( part, PMGLView::PMViewCamera, glArea );
   topLayout->addWidget( gl, 1, 1 );
   
   m_pMainSplitter->show( );

   layout->addWidget( m_pMainSplitter );
   layout->activate( );

   m_pPart = part;
}

PMView::~PMView( )
{
}

void PMView::print( TQPrinter* pPrinter )
{
   TQPainter printpainter;
   printpainter.begin( pPrinter );
	
   // TODO: add your printing code here

   printpainter.end( );
}

void PMView::saveConfig( KConfig* cfg )
{
   cfg->setGroup( "Appearance" );

   cfg->writeEntry( "MainSplitter", m_pMainSplitter->sizes( ) );
   cfg->writeEntry( "TreeEditSplitter", m_pTreeEditSplitter->sizes( ) );
}

void PMView::restoreConfig( KConfig* cfg )
{
   cfg->setGroup( "Appearance" );

   m_pMainSplitter->setSizes( cfg->readIntListEntry( "MainSplitter" ) );
   m_pTreeEditSplitter->setSizes( cfg->readIntListEntry( "TreeEditSplitter" ) );
}


#include "pmview.moc"