Ticket #10840: 0001-Use-user-color-for-selected-menuItem-in-ProcessContr.patch

File 0001-Use-user-color-for-selected-menuItem-in-ProcessContr.patch, 5.3 KB (added by Janus, 4 years ago)
  • src/apps/processcontroller/KernelMemoryBarMenuItem.cpp

    From 20863175a0a48640364e750dc4fc81c2f528b95d Mon Sep 17 00:00:00 2001
    From: Janus <janus2@ymail.com>
    Date: Wed, 18 Mar 2015 22:41:48 +0000
    Subject: [PATCH] Use user color for selected menuItem in ProcessController
    
    ---
     src/apps/processcontroller/KernelMemoryBarMenuItem.cpp | 5 +++--
     src/apps/processcontroller/MemoryBarMenuItem.cpp       | 9 +++++++--
     src/apps/processcontroller/NoiseBarMenuItem.cpp        | 5 +++--
     src/apps/processcontroller/TeamBarMenuItem.cpp         | 3 ++-
     src/apps/processcontroller/ThreadBarMenuItem.cpp       | 3 ++-
     5 files changed, 17 insertions(+), 8 deletions(-)
    
    diff --git a/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp b/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp
    index 8b7772b..30b5fe0 100644
    a b KernelMemoryBarMenuItem::DrawBar(bool force) 
    7070    bool selected = IsSelected();
    7171    BRect frame = Frame();
    7272    BMenu* menu = Menu();
     73    rgb_color highColor = menu->HighColor();
    7374
    7475    // draw the bar itself
    7576    BRect cadre (frame.right - kMargin - kBarWidth, frame.top + 5,
    KernelMemoryBarMenuItem::DrawBar(bool force) 
    133134            menu->SetHighColor(kWhite);
    134135        menu->FillRect(r);
    135136    }
    136     menu->SetHighColor(kBlack);
     137    menu->SetHighColor(highColor);
    137138    fGrenze1 = grenze1;
    138139    fGrenze2 = grenze2;
    139140
    KernelMemoryBarMenuItem::DrawBar(bool force) 
    150151        BRect trect(cadre.left - kMargin - gMemoryTextWidth, frame.top,
    151152            cadre.left - kMargin, frame.bottom);
    152153        menu->FillRect(trect);
    153         menu->SetHighColor(kBlack);
     154        menu->SetHighColor(highColor);
    154155
    155156        char infos[128];
    156157        string_for_size(fCachedMemory * 1024.0, infos, sizeof(infos));
  • src/apps/processcontroller/MemoryBarMenuItem.cpp

    diff --git a/src/apps/processcontroller/MemoryBarMenuItem.cpp b/src/apps/processcontroller/MemoryBarMenuItem.cpp
    index bd5ccb7..d8d087f 100644
    a b MemoryBarMenuItem::DrawBar(bool force) 
    114114    bool selected = IsSelected();
    115115    BRect frame = Frame();
    116116    BMenu* menu = Menu();
     117    rgb_color highColor = menu->HighColor();
    117118
    118119    // draw the bar itself
    119120
    MemoryBarMenuItem::DrawBar(bool force) 
    186187        menu->FillRect(r);
    187188    }
    188189
    189     menu->SetHighColor(kBlack);
     190    menu->SetHighColor(highColor);
    190191    fGrenze1 = grenze1;
    191192    fGrenze2 = grenze2;
    192193
    MemoryBarMenuItem::DrawBar(bool force) 
    210211    fLastWrite = fWriteMemory;
    211212    fLastAll = fAllMemory;
    212213
    213     menu->SetHighColor(kBlack);
     214    if (selected)
     215        menu->SetHighColor(ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR));
     216    else
     217        menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
    214218
    215219    char infos[128];
    216220    string_for_size(fWriteMemory * 1024.0, infos, sizeof(infos));
    MemoryBarMenuItem::DrawBar(bool force) 
    222226    string_for_size(fAllMemory * 1024.0, infos, sizeof(infos));
    223227    loc.x = rect.left - kMargin - menu->StringWidth(infos);
    224228    menu->DrawString(infos, loc);
     229    menu->SetHighColor(highColor);
    225230}
    226231
    227232
  • src/apps/processcontroller/NoiseBarMenuItem.cpp

    diff --git a/src/apps/processcontroller/NoiseBarMenuItem.cpp b/src/apps/processcontroller/NoiseBarMenuItem.cpp
    index 5f53807..9446a06 100644
    a b NoiseBarMenuItem::DrawBar(bool force) 
    5151    bool selected = IsSelected();
    5252    BRect frame = Frame();
    5353    BMenu* menu = Menu();
     54    rgb_color highColor = menu->HighColor();
    5455    frame.right -= 24;
    5556    frame.left = frame.right - kBarWidth;
    5657    frame.top += 5;
    NoiseBarMenuItem::DrawBar(bool force) 
    9798            r.right = fGrenze1;
    9899    }
    99100    if (r.left < r.right) {
    100         menu->SetHighColor(kBlack);
     101        menu->SetHighColor(highColor);
    101102//      menu->SetHighColor(gUserColor);
    102103        menu->FillRect(r);
    103104    }
    NoiseBarMenuItem::DrawBar(bool force) 
    112113            menu->SetHighColor(kWhite);
    113114        menu->FillRect(r);
    114115    }
    115     menu->SetHighColor(kBlack);
     116    menu->SetHighColor(highColor);
    116117    fGrenze1 = grenze1;
    117118    fGrenze2 = grenze2;
    118119}
  • src/apps/processcontroller/TeamBarMenuItem.cpp

    diff --git a/src/apps/processcontroller/TeamBarMenuItem.cpp b/src/apps/processcontroller/TeamBarMenuItem.cpp
    index 82f7e31..3f4a73e 100644
    a b TeamBarMenuItem::DrawBar(bool force) 
    123123    bool selected = IsSelected ();
    124124    BRect frame = Frame();
    125125    BMenu* menu = Menu ();
     126    rgb_color highColor = menu->HighColor();
    126127    frame.right -=  24;
    127128    frame.left = frame.right-kBarWidth;
    128129    frame.top += 5;
    TeamBarMenuItem::DrawBar(bool force) 
    209210        menu->FillRect(r);
    210211    }
    211212
    212     menu->SetHighColor(kBlack);
     213    menu->SetHighColor(highColor);
    213214    fGrenze1 = grenze1;
    214215    fGrenze2 = grenze2;
    215216}
  • src/apps/processcontroller/ThreadBarMenuItem.cpp

    diff --git a/src/apps/processcontroller/ThreadBarMenuItem.cpp b/src/apps/processcontroller/ThreadBarMenuItem.cpp
    index 94b2d1d..8845dcb 100644
    a b ThreadBarMenuItem::DrawBar(bool force) 
    5656    bool selected = IsSelected();
    5757    BRect frame = Frame();
    5858    BMenu* menu = Menu();
     59    rgb_color highColor = menu->HighColor();
    5960    frame.right -= 24;
    6061    frame.left = frame.right - kBarWidth;
    6162    frame.top += 3;
    ThreadBarMenuItem::DrawBar(bool force) 
    127128            menu->SetHighColor(kWhite);
    128129        menu->FillRect(r);
    129130    }
    130     menu->SetHighColor(kBlack);
     131    menu->SetHighColor(highColor);
    131132    fGrenze1 = grenze1;
    132133    fGrenze2 = grenze2;
    133134}