~ubuntu-branches/ubuntu/trusty/fluxbox/trusty-proposed

« back to all changes in this revision

Viewing changes to src/FbTk/Menu.cc

  • Committer: Package Import Robot
  • Author(s): Paul Tagliamonte
  • Date: 2010-08-12 21:16:02 UTC
  • mfrom: (0.1.1) (1.1.10)
  • Revision ID: package-import@ubuntu.com-20100812211602-3tsmzl9in5nmwz7z
Tags: 1.1.1+git20100807.0cc08f9-1
* debian/ dir has been cleaned out, complete repackage
  of most files.
* pulled new archive from git.fluxbox.org HEAD, saved as
  tar.gz.
* Added in fluxbox.* files from the old dfsg tree.
* Added in system.fluxbox-menu file from the old dfsg tree
* Added the source/format file to bump package source
  version from 1.0 to 3.0 (quilt). 
* Changed rules file to match the old dfsg setup so that
  fluxbox behaves nicely.
* Removed entries from copyright that no longer apply.
* Added theme based on Denis Brand ( naran )'s old theme.
* Added a background I whipped up.
* Changed compile flags to point to debian theme by default
* Adding a patch to have fluxbox use x-terminal-emulator
  over xterm. Closes: #591694 (LP: #580485)
* Adding a patch to allow titlebar-window dragging.
* Changed the flags in rules to pull from a script. This script
  lets us un-hardcode what theme is default. Be sure there
  is a theme pack!
* Added comments to my patches.
* Removing debian/docs, empty file.
* Fixing fluxbox.desktop to remove all the warnings from
  desktop-file-validate
* Fixing libtool issue by running an update before
  configure in the rules script.
* Added a compile flag script to auto-detect what platform
  we are running on, and apply the correct theme. This
  should solve Ubuntnu issues later on.
* adding in a get-orig-source rule
* fixing the upstream version number to pinpoint
  the commit ( thanks, lfaraone ).
* adding a rule for get-orig-source. ( thanks again,
  lfaraone ).
* Updated rules to actually allow us to do a build from it
* Removed Denis from the uploaders ( as per an email
  conversation )
* Removing madduck from the uploaders ( thanks for asking,
  lfaraone. ). Thanks for your hard work, madduck.

Show diffs side-by-side

added added

removed removed

Lines of Context:
219
219
    } else {
220
220
        menuitems.insert(menuitems.begin() + pos, item);
221
221
        fixMenuItemIndices();
 
222
        if (m_active_index >= pos)
 
223
            m_active_index++;
222
224
    }
223
225
    m_need_update = true; // we need to redraw the menu
224
226
    return menuitems.size();
233
235
    if (index >= menuitems.size()) {
234
236
#ifdef DEBUG
235
237
        cout << "Bad index (" << index << ") given to Menu::remove()"
236
 
                  << " -- should be between 0 and " << menuitems.size()
 
238
                  << " -- should be between 0 and " << menuitems.size()-1
237
239
                  << " inclusive." << endl;
238
240
#endif // DEBUG
239
241
        return -1;
271
273
    else if (static_cast<unsigned int>(m_which_sub) > index)
272
274
        m_which_sub--;
273
275
 
 
276
    if (static_cast<unsigned int>(m_active_index) > index)
 
277
        m_active_index--;
 
278
 
274
279
    m_need_update = true; // we need to redraw the menu
275
280
 
276
281
    return menuitems.size();
323
328
            new_index = vec[i]->getIndex();
324
329
    }
325
330
 
326
 
    if (new_index == -1)
327
 
        return;
 
331
    if (new_index != -1)
 
332
        setActiveIndex(new_index);
 
333
}
328
334
 
 
335
void Menu::setActiveIndex(int new_index) {
329
336
    // clear the items and close any open submenus
330
337
    int old_active_index = m_active_index;
331
338
    m_active_index = new_index;
366
373
    setTitleVisibility(true);
367
374
}
368
375
 
369
 
void Menu::updateMenu(int active_index) {
 
376
void Menu::updateMenu() {
370
377
    if (m_title_vis) {
371
378
        menu.item_w = theme()->titleFont().textWidth(menu.label,
372
379
                                                    menu.label.size());
752
759
        if (! m_moving)
753
760
            clearItem(index);
754
761
 
755
 
        if (! item->submenu()->isVisible()) {
 
762
        if (! item->submenu()->isVisible() && item->submenu()->numberOfItems() > 0) {
756
763
            shown = item->submenu();
757
764
            item->showSubmenu();
758
765
            item->submenu()->raise();
989
996
 
990
997
        }
991
998
 
992
 
        if (itmp->submenu() && theme()->menuMode() == MenuTheme::DELAY_OPEN) {
 
999
        if (itmp->submenu()) {
993
1000
            // start submenu open delay
994
1001
            timeval timeout;
995
1002
            timeout.tv_sec = 0;
996
 
            timeout.tv_usec = theme()->delayOpen() * 1000; // transformed to usec
 
1003
            timeout.tv_usec = theme()->getDelay() * 1000; // transformed to usec
997
1004
            m_submenu_timer.setTimeout(timeout);
998
1005
            m_submenu_timer.start();
999
1006
        } else if (isItemSelectable(w)){
1060
1067
        break;
1061
1068
    case XK_Left: // enter parent if we have one
1062
1069
        resetTypeAhead();
1063
 
        internal_hide();
 
1070
        if (menu.sublevels > 1 && m_active_index >= menu.persub) {
 
1071
            int new_index = m_active_index - menu.persub;
 
1072
            while (new_index >= 0 && !isItemEnabled(new_index))
 
1073
                new_index -= menu.persub;
 
1074
            if (new_index >= 0)
 
1075
                setActiveIndex(new_index);
 
1076
        } else
 
1077
            internal_hide();
1064
1078
        break;
1065
1079
    case XK_Right: // enter submenu if we have one
1066
1080
        resetTypeAhead();
1067
 
        enterSubmenu();
 
1081
        if (menu.sublevels > 1 && validIndex(m_active_index) &&
 
1082
            validIndex(m_active_index + menu.persub)) {
 
1083
            int new_index = m_active_index + menu.persub;
 
1084
            while (validIndex(new_index) && !isItemEnabled(new_index))
 
1085
                new_index += menu.persub;
 
1086
            if (validIndex(new_index))
 
1087
                setActiveIndex(new_index);
 
1088
        } else
 
1089
            enterSubmenu();
1068
1090
        break;
1069
1091
    case XK_Escape: // close menu
1070
1092
        m_type_ahead.reset();
1186
1208
void Menu::startHide() {
1187
1209
    timeval timeout;
1188
1210
    timeout.tv_sec = 0;
1189
 
    timeout.tv_usec = theme()->delayClose() * 1000; // transformed to usec
 
1211
    timeout.tv_usec = theme()->getDelay() * 1000; // transformed to usec
1190
1212
    m_hide_timer.setTimeout(timeout);
1191
1213
    m_hide_timer.start();
1192
1214
}