diff --git a/source/libwiigui/gui.h b/source/libwiigui/gui.h index 7d672250..fe870fd0 100644 --- a/source/libwiigui/gui.h +++ b/source/libwiigui/gui.h @@ -746,11 +746,7 @@ class GuiButton : public GuiElement void SetSoundClick(GuiSound * s); //!Constantly called to draw the GuiButtons ToolTip //!Sets the button's Tooltip on over - //!\param i Pointer to GuiImage object, t Pointer to GuiText, x & y Positioning -// void SetToolTip(GuiImage* i, GuiText * t, int x, int y); - //!Constantly called to draw the GuiButtons ToolTip - //!Sets the button's Tooltip on over - //!\param i Pointer to GuiImage object, t Pointer to GuiText, x & y Positioning + //!\param tt Pointer to GuiElement object, x & y Positioning, h & v Align void SetToolTip(GuiElement* tt, int x, int y, int h=ALIGN_RIGHT, int v=ALIGN_TOP); //!Constantly called to draw the GuiButton void Draw(); @@ -769,9 +765,7 @@ class GuiButton : public GuiElement GuiImage * iconOver; //!< Button icon for STATE_SELECTED GuiImage * iconHold; //!< Button icon for STATE_HELD GuiImage * iconClick; //!< Button icon for STATE_CLICKED - GuiImage * toolTip; //!< Tooltip for STATE_SELECTED - GuiText * toolTipTxt;//!< Tooltip Text - GuiElement *toolTip2; + GuiElement *toolTip; time_t time1, time2;//!< Tooltip timeconstants GuiText * label[3]; //!< Label(s) to display (default) GuiText * labelOver[3]; //!< Label(s) to display for STATE_SELECTED diff --git a/source/libwiigui/gui_button.cpp b/source/libwiigui/gui_button.cpp index 602592be..c1d408e8 100644 --- a/source/libwiigui/gui_button.cpp +++ b/source/libwiigui/gui_button.cpp @@ -29,8 +29,6 @@ GuiButton::GuiButton(int w, int h) iconHold = NULL; iconClick = NULL; toolTip = NULL; - toolTip2 = NULL; - toolTipTxt = NULL; for(int i=0; i < 3; i++) { @@ -169,10 +167,10 @@ void GuiButton::SetToolTip(GuiElement* tt, int x, int y, int h_align, int v_alig LOCK(this); if(tt) { - toolTip2 = tt; - toolTip2->SetParent(this); - toolTip2->SetAlignment(h_align, v_align); - toolTip2->SetPosition(x,y); + toolTip = tt; + toolTip->SetParent(this); + toolTip->SetAlignment(h_align, v_align); + toolTip->SetPosition(x,y); } } @@ -209,7 +207,7 @@ void GuiButton::Draw() void GuiButton::DrawTooltip() { LOCK(this); - if(state == STATE_SELECTED && (toolTip || toolTip2)) + if(state == STATE_SELECTED && toolTip) { if (time2 == 0) { @@ -222,50 +220,21 @@ void GuiButton::DrawTooltip() if(time1 == 0 || difftime(time1, time2) >= 2) { if(time1 != 0) // timer gerade abgelaufen - if(toolTip2) toolTip2->SetEffect(EFFECT_FADE, 20); + toolTip->SetEffect(EFFECT_FADE, 20); time1 = 0; - if(toolTip2) toolTip2->Draw(); - if(toolTip) toolTip->Draw(); - if (toolTipTxt) - { - toolTipTxt->Draw(); - } + toolTip->Draw(); return; } } else { if(time2 != 0 && time1 == 0) // timer abgelaufen, gerade DESELECT - if(toolTip2) toolTip2->SetEffect(EFFECT_FADE, -20); + if(toolTip) toolTip->SetEffect(EFFECT_FADE, -20); time2 = 0; } - if(toolTip2 && toolTip2->GetEffect()) - toolTip2->Draw(); + if(toolTip && toolTip->GetEffect()) + toolTip->Draw(); } -/* -void GuiButton::DrawTooltip() -{ - LOCK(this); - if(state == STATE_SELECTED && (toolTip || toolTip2)) - { - if (time2 == 0) - time(&time2); - - time(&time1); - - if (difftime(time1, time2) >= 2) { - if(toolTip) toolTip->Draw(); - if(toolTip2) toolTip2->Draw(); - if (toolTipTxt) - { - toolTipTxt->Draw(); - } - } - } - else - time2 = 0; -} -*/ void GuiButton::ScrollIsOn(int f) { LOCK(this); diff --git a/source/menu.cpp b/source/menu.cpp index 3ace63ee..6104a640 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -1861,7 +1861,8 @@ UpdateGUI (void *arg) else { mainWindow->Draw(); - mainWindow->DrawTooltip(); + if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) + mainWindow->DrawTooltip(); #ifdef HW_RVL for(int i=3; i >= 0; i--) // so that player 1's cursor appears on top! @@ -1871,7 +1872,7 @@ UpdateGUI (void *arg) 96, 96, pointer[i]->GetImage(), userInput[i].wpad.ir.angle, CFG.widescreen? 0.8 : 1, 1, 255); if(Settings.rumble == RumbleOn) { - DoRumble(i); + DoRumble(i); } } #endif @@ -2424,8 +2425,7 @@ static int MenuDiscList() installBtn.SetSoundClick(&btnClick); installBtn.SetTrigger(&trigA); installBtn.SetEffectGrow(); - if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - installBtn.SetToolTip(&installBtnTT,24,-30, ALIGN_LEFT); + installBtn.SetToolTip(&installBtnTT,24,-30, ALIGN_LEFT); GuiTooltip settingsBtnTT("Settings"); if (Settings.wsprompt == yes) @@ -2444,8 +2444,7 @@ static int MenuDiscList() settingsBtn.SetSoundClick(&btnClick); settingsBtn.SetTrigger(&trigA); settingsBtn.SetEffectGrow(); - if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - settingsBtn.SetToolTip(&settingsBtnTT,65,-30); + settingsBtn.SetToolTip(&settingsBtnTT,65,-30); GuiTooltip homeBtnTT("Back to HBC or Wii Menu"); if (Settings.wsprompt == yes) @@ -2465,8 +2464,7 @@ static int MenuDiscList() homeBtn.SetTrigger(&trigA); homeBtn.SetTrigger(&trigHome); homeBtn.SetEffectGrow(); - if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - homeBtn.SetToolTip(&homeBtnTT,15,-30); + homeBtn.SetToolTip(&homeBtnTT,15,-30); GuiTooltip poweroffBtnTT("Power off the Wii"); if (Settings.wsprompt == yes) @@ -2486,8 +2484,7 @@ static int MenuDiscList() poweroffBtn.SetSoundClick(&btnClick); poweroffBtn.SetTrigger(&trigA); poweroffBtn.SetEffectGrow(); - if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - poweroffBtn.SetToolTip(&poweroffBtnTT,-10,-30); + poweroffBtn.SetToolTip(&poweroffBtnTT,-10,-30); GuiTooltip sdcardBtnTT("Reload SD"); @@ -2504,8 +2501,7 @@ static int MenuDiscList() sdcardBtn.SetSoundClick(&btnClick); sdcardBtn.SetTrigger(&trigA); sdcardBtn.SetEffectGrow(); - if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - sdcardBtn.SetToolTip(&sdcardBtnTT,95,-40); + sdcardBtn.SetToolTip(&sdcardBtnTT,95,-40); //Downloading Covers GuiTooltip DownloadBtnTT("Click to Download Covers"); @@ -2520,8 +2516,7 @@ static int MenuDiscList() {//only make the button have trigger & tooltip if in godmode DownloadBtn.SetSoundOver(&btnSoundOver); DownloadBtn.SetTrigger(&trigA); - if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - DownloadBtn.SetToolTip(&DownloadBtnTT,205,-30); + DownloadBtn.SetToolTip(&DownloadBtnTT,205,-30); } else DownloadBtn.SetRumble(false); @@ -3463,8 +3458,7 @@ static int MenuSettings() if (Settings.wsprompt == yes) page1BtnTT.SetWidescreen(CFG.widescreen);/////////// - if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - page1Btn.SetToolTip(&page1BtnTT,105, 15); + page1Btn.SetToolTip(&page1BtnTT,105, 15); GuiImage page2Img(&page2); @@ -3481,8 +3475,7 @@ static int MenuSettings() if (Settings.wsprompt == yes) page2BtnTT.SetWidescreen(CFG.widescreen);/////////// - if (Settings.tooltips == TooltipsOn && THEME.showToolTip != 0) - page2Btn.SetToolTip(&page2BtnTT,105,0); + page2Btn.SetToolTip(&page2BtnTT,105,0); ////////////////////////////////