diff options
Diffstat (limited to 'src/kooldock.cpp')
-rw-r--r-- | src/kooldock.cpp | 87 |
1 files changed, 41 insertions, 46 deletions
diff --git a/src/kooldock.cpp b/src/kooldock.cpp index 93d43ee..cad4541 100644 --- a/src/kooldock.cpp +++ b/src/kooldock.cpp @@ -73,8 +73,7 @@ KoolDock::KoolDock(TQWidget* parent, const char* name) : menuPath = progPath + TQString("/menu/"); confFile = locateLocal("config", "kooldockrc"); - noSet = false; - firstInit = true; + lockSetTab= false; // disables changing opened tab in preferences window setupdlg = new SetupDialogPrg(); // create the setup dialog object. connect(setupdlg, SIGNAL(apply()), SLOT(chkRestart())); @@ -100,24 +99,7 @@ KoolDock::KoolDock(TQWidget* parent, const char* name) : connect(tasklist, SIGNAL(activated(int)), this, SLOT(goToWindow(int))); connect(deskpopup, SIGNAL(activated(int)), this, SLOT(sendToDesktop(int))); menuCount = 0; - - init1(); - - if (fFirstRun) - { - // Show welcome dialog. - const char* welcomeMsg = - I18N_NOOP("<center><B>Welcome</B></center>It appears to be the first time you run KoolDock.<br>" - "By default the dock is hidden at the botton of the screen, move your mouse" - " to the bottom edge of the screen and the dock will appear.<br>" - "Right click on the dock for a menu that allows you to configure it<br>" - "or run with <I>-o</I> parameter to have preferences window at start.<br>" - "We hope this software is usefull for you<br>-- The KoolDock Team"); - KMessageBox::information(0L, i18n(welcomeMsg)); - saveConf(); // create initial configuration. - } - init2(); - firstInit = false; + init(); //initialization } KoolDock::~KoolDock() @@ -136,13 +118,13 @@ KoolDock::~KoolDock() if (_filterData) delete(_filterData); } -void KoolDock::mTimerEnd() +void KoolDock::mTimerEnd() // mouse emulation timer { if (menuCount > 0) { - return; + return; // a popup is still opened - disable scrolling } TQPoint pointer = TQCursor::pos(); - lastXPos = pointer.x() - rx; + lastXPos = pointer.x() - rx; // remember current mouse position (relative to window position) lastYPos = pointer.y() - ry; int px, py, pw, ph; int mpx = pointer.x(); @@ -250,7 +232,6 @@ void KoolDock::trackTimer2End() getTopBG(); } debug(TQString("tracktimer: grabWindow(%1, %2, %3, %4)").arg(x1).arg(dh - h1).arg(w1).arg(h1)); - move2(x, dh - h); resize2(w, h); Ybase = iwBig2; enterEvent(NULL); @@ -303,7 +284,7 @@ void KoolDock::paintEvent(TQPaintEvent *) int p1 = 0; int p2 = 0; KPixmapIO pixio; - + if (!fLeftImg.isEmpty()) { TempBG = pixio.convertToImage(LeftImg); if ((fOrientation & 1) == 1) { @@ -625,7 +606,7 @@ void KoolDock::paintEvent(TQPaintEvent *) KPixmapEffect::fade(*currentIcon, ((float) 60) * 0.01, TQColor("#FFFFFF")); } // End drawing icon effects - + Xpos += x; if ((fOrientation & 1) == 1) { std::swap(Xpos, Ypos); @@ -637,7 +618,7 @@ void KoolDock::paintEvent(TQPaintEvent *) } } // End drawing icons - // Draw the seperator between launcher and taskbar + // Draw the seperators between launcher and taskbar, and between tasbar and systray if (fShowTaskbar && ((numLaunchers > 0 && ((int) items.count() > numLaunchers)) || ((fShowKMenu == 1) && (items.count() > 1)))) { i = numLaunchers - 1; if ((i >= 0) && (i < (int) items.count() - 1)) { @@ -1406,7 +1387,7 @@ void KoolDock::enterEvent (TQEvent *) iwBig = iwSmall; } resize2(w, h); - move2(x, dh - h); + move2(x, rdh); funcH = iwBig - iwSmall; iy = (iDist - iwSmall) / 2; @@ -1414,12 +1395,14 @@ void KoolDock::enterEvent (TQEvent *) fExpanded = true; oldfirstX = x; oldtmpw = w; - paintEvent(NULL); debug("enterEvent"); zoomTicksB = 0; zoomTicksS = 0; perf->start(); mkbigTimer->start(zoomStep, false); + mkbigTimerDo(); + paintEvent(NULL); + move2(x,dh-h); } void KoolDock::onleaveEvent(TQEvent *) @@ -2013,7 +1996,7 @@ void KoolDock::rmwTask(int iFound) Item* item; int i; int ind = witems.at(iFound)->getIndex(); - + for (i = 0, item = witems.at(0); item; i++, item = witems.next()) { if (item->getIndex() > ind) { item->setIndex(item->getIndex() - 1); @@ -2458,10 +2441,8 @@ void KoolDock::editPref() } loadIgnore(); // Load Ignore List - if (!setupdlg->isVisible()) { - if (!noSet) { - setupdlg->tabWidget->setCurrentPage(0); - } + if (!setupdlg->isVisible() && !lockSetTab) { + setupdlg->tabWidget->setCurrentPage(0); } setupdlg->toReloadIcons->setChecked(false); @@ -3084,16 +3065,15 @@ void KoolDock::reload() items.clear(); witems.clear(); } - init1(); - init2(); + init(); if (setupdlg->isVisible()) { - noSet = true; + lockSetTab=true; editPref(); if (reloadIcons) { setupdlg->appClear(); setupdlg->appFill(); } - noSet = false; + lockSetTab=false; } } @@ -3313,10 +3293,10 @@ void KoolDock::menuX(int num) } } -void KoolDock::init1() +void KoolDock::init() { initialization = true; - nDesks=-1; + nDesks=-2; ptPart = 5; // Load the configuration loadConf(); @@ -3374,7 +3354,7 @@ void KoolDock::init1() } } - // Load the menu entries + //Lets load the menu entries if (reloadIcons) { loadMenu(); } @@ -3491,6 +3471,7 @@ void KoolDock::init1() ii_last = items.count() - 1; iOnClick = -1; onChangeTimer = NULL; + Ybase = 0; soffset = 0; eoffset = 0; @@ -3552,10 +3533,21 @@ void KoolDock::init1() iSpace * 2) / 2 - 4 * iwSmall - (int) ((3 * iDist + 1 - funcW) * (func(0) + func (iDist) - 2 * iwSmall) / (2 * iDist)) + 1; eoffset= (int) ((iwBig2 - iwSmall) * fAmount / 100); doUpdateGeometry(); -} + if (fFirstRun) + { + fFirstRun=false; + // Show welcome dialog. + const char* welcomeMsg = + I18N_NOOP("<center><B>Welcome</B></center>It appears to be the first time you run KoolDock.<br>" + "By default the dock is hidden at the botton of the screen, move your mouse" + " to the bottom edge of the screen and the dock will appear.<br>" + "Right click on the dock for a menu that allows you to configure it<br>" + "or run with <I>-o</I> parameter to have preferences window at start.<br>" + "We hope this software is usefull for you<br>-- The KoolDock Team"); + KMessageBox::information(0L, i18n(welcomeMsg)); + saveConf(); // create initial configuration. + } -void KoolDock::init2() -{ clipw = new clip(); if (fHidden == 1) { @@ -3631,6 +3623,7 @@ void KoolDock::init2() } else { pTest(); + } } @@ -3705,6 +3698,7 @@ void KoolDock::dropEvent(TQDropEvent* event) useList = false; } +//Funtion used in window grouping void KoolDock::movetoback(WId id) { int i; @@ -3740,6 +3734,7 @@ void KoolDock::movetoback(WId id) } } +//Gets index of an incon by position int KoolDock::itemFromPoint(int x) { int i, Xpos = -1; @@ -3749,10 +3744,10 @@ int KoolDock::itemFromPoint(int x) break; } } - currXPos = Xpos; return i; } +//Gets position of an icon by its index int KoolDock::xFromIndex(int i) { int Xpos; @@ -3825,7 +3820,7 @@ void KoolDock::updTaskList() desks.setAutoDelete(true); //tasklist; menu to access every window throught navigation menu - int j, index, incr, nDesks; + int j, index, incr; KWin::WindowInfo tmpinfo; nDesks = KWin::numberOfDesktops(); |