-
Notifications
You must be signed in to change notification settings - Fork 1
/
MAINWADM.CPP
88 lines (75 loc) · 2.13 KB
/
MAINWADM.CPP
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
#include "bowl.h"
#include "mainwadm.h"
#include "mainwnd.h"
MainWindow **MainWindowAdmin::mWindows = NULL;
int MainWindowAdmin::windowCount = 0;
MainWindow *MainWindowAdmin::activeWindow = NULL;
int MainWindowAdmin::ACTIVECONTROL = 1;
int MainWindowAdmin::INFOBAR = 2;
int MainWindowAdmin::BUTTONS = 4;
int MainWindowAdmin::MAINWINDOWLAYOUT = 8;
int MainWindowAdmin::MENU = 16;
int MainWindowAdmin::FRAME = 32;
void MainWindowAdmin::removeWindow( MainWindow *mWindow )
{
for( int i = 0; i < windowCount; i++ )
if( mWindow == mWindows[i] )
{
memmove( &mWindows[i], &mWindows[i+1], sizeof( mWindows ) * (windowCount-i-1) );
windowCount--;
break;
}
// If the active window is the one that is removed,
// then, set the activeWindow to any other window.
// If the next window focused is a Kon window, the activeWindow
// will be correctly set again
if( mWindow == activeWindow )
activeWindow = mWindows[0];
}
void MainWindowAdmin::nextTab( Window *window )
{
for( int i = 0; i < windowCount; i++ )
if( mWindows[i]->getNotebook() == window )
{
mWindows[i]->nextTab();
break;
}
}
void MainWindowAdmin::prevTab( Window *window )
{
for( int i = 0; i < windowCount; i++ )
if( mWindows[i]->getNotebook() == window )
{
mWindows[i]->prevTab();
break;
}
}
void MainWindowAdmin::newFile( char *file, Window *window )
{
for( int i = 0; i < windowCount; i++ )
if( mWindows[i]->getNotebook() == window )
{
ControllerWindow::getInstance()->loadFile( mWindows[i], file, TRUE, TRUE, Settings::reuseExistingBuffer );
// mWindows[i]->addFile( file, TRUE, TRUE );
break;
}
}
void MainWindowAdmin::setActiveWindow( MainWindow *window )
{
activeWindow = window;
}
void MainWindowAdmin::updateAllWindows( int parts )
{
for( int i = 0; i < windowCount; i++ )
{
//mWindows[i]->repaint( NULL, TRUE );
if( parts & FRAME )
mWindows[i]->size( -1, -1 );
if( parts & ACTIVECONTROL )
mWindows[i]->getActiveControl()->repaintView(NULL);
if( parts & INFOBAR )
mWindows[i]->updateInfobar();
if( parts & MENU )
mWindows[i]->updateMenu();
}
}