diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/list.cpp | 14 | ||||
-rw-r--r-- | src/ui/list.h | 11 | ||||
-rw-r--r-- | src/ui/maindialog.cpp | 36 | ||||
-rw-r--r-- | src/ui/studio.cpp | 4 | ||||
-rw-r--r-- | src/ui/window.cpp | 4 | ||||
-rw-r--r-- | src/ui/window.h | 2 |
6 files changed, 41 insertions, 30 deletions
diff --git a/src/ui/list.cpp b/src/ui/list.cpp index fae7af9..7593582 100644 --- a/src/ui/list.cpp +++ b/src/ui/list.cpp @@ -88,6 +88,14 @@ bool CList::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMs return MoveAdjust(); } +// Should never be called +bool CList::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType) +{ + assert(false); + return false; +} + + // Adjusted after a change of dimensions. bool CList::MoveAdjust() @@ -611,7 +619,7 @@ bool CList::GetBlink() // Specifies the text of a line. -void CList::SetName(int i, const char* name) +void CList::SetItemName(int i, const char* name) { if ( i < 0 || i >= LISTMAXTOTAL ) return; @@ -630,7 +638,7 @@ void CList::SetName(int i, const char* name) // Returns the text of a line. -char* CList::GetName(int i) +char* CList::GetItemName(int i) { if ( i < 0 || i >= m_totalLine ) return 0; @@ -808,4 +816,4 @@ void CList::MoveScroll() } -} +} // namespace Ui diff --git a/src/ui/list.h b/src/ui/list.h index 97bd48c..3d2e517 100644 --- a/src/ui/list.h +++ b/src/ui/list.h @@ -69,8 +69,8 @@ class CList : public CControl void SetBlink(bool bEnable); bool GetBlink(); - void SetName(int i, const char* name); - char* GetName(int i); + void SetItemName(int i, const char* name); + char* GetItemName(int i); void SetCheck(int i, bool bMode); bool GetCheck(int i); @@ -93,6 +93,10 @@ class CList : public CControl void MoveScroll(); void DrawCase(char *text, Math::Point pos, float width, Gfx::TextAlign justif); + private: + // Overridden to avoid warning about hiding the virtual function + virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType) override; + protected: CButton* m_button[LISTMAXDISPLAY]; CScroll* m_scroll; @@ -117,5 +121,4 @@ class CList : public CControl }; -} - +} // namespace Ui diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index 14c1e82..696c156 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -199,7 +199,7 @@ CMainDialog::~CMainDialog() void CMainDialog::ChangePhase(Phase phase) { - CWindow* pw; + CWindow* pw = nullptr; CEdit* pe; CEditValue* pv; CLabel* pl; @@ -2310,7 +2310,7 @@ bool CMainDialog::EventProcess(const Event &event) if ( pw == 0 ) break; pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST)); if ( pl == 0 ) break; - StartDeleteGame(pl->GetName(pl->GetSelect())); + StartDeleteGame(pl->GetItemName(pl->GetSelect())); break; default: @@ -3688,7 +3688,7 @@ void CMainDialog::ReadNameList() for (size_t i=0 ; i<fileNames.size() ; ++i ) { - pl->SetName(i, fileNames.at(i).c_str()); + pl->SetItemName(i, fileNames.at(i).c_str()); } } @@ -3764,7 +3764,7 @@ void CMainDialog::UpdateNameList() for ( i=0 ; i<total ; i++ ) { // TODO: stricmp? - if ( strcmp(name, pl->GetName(i)) == 0 ) + if ( strcmp(name, pl->GetItemName(i)) == 0 ) { pl->SetSelect(i); pl->ShowSelect(false); @@ -3800,7 +3800,7 @@ void CMainDialog::UpdateNameEdit() } else { - name = pl->GetName(sel); + name = pl->GetItemName(sel); pe->SetText(name); pe->SetCursor(strlen(name), 0); } @@ -3824,7 +3824,7 @@ void CMainDialog::UpdateNameFace() sel = pl->GetSelect(); if ( sel == -1 ) return; - name = pl->GetName(sel); + name = pl->GetItemName(sel); ReadGamerPerso(name); } @@ -3855,7 +3855,7 @@ void CMainDialog::NameSelect() } else { - m_main->SetGamerName(pl->GetName(sel)); + m_main->SetGamerName(pl->GetItemName(sel)); m_main->ChangePhase(PHASE_INIT); } @@ -3982,7 +3982,7 @@ void CMainDialog::NameDelete() m_sound->Play(SOUND_TZOING); return; } - gamer = pl->GetName(sel); + gamer = pl->GetItemName(sel); // Deletes all the contents of the file. sprintf(dir, "%s/%s", m_savegameDir.c_str(), gamer); @@ -4417,7 +4417,7 @@ void CMainDialog::IOReadList() } fclose(file); - pl->SetName(m_saveList.size(), name); + pl->SetItemName(m_saveList.size(), name); m_saveList.push_back(dir_iter->path()); } } @@ -4426,7 +4426,7 @@ void CMainDialog::IOReadList() // zly indeks if ( m_phase == PHASE_WRITE || m_phase == PHASE_WRITEs ) { GetResource(RES_TEXT, RT_IO_NEW, name); - pl->SetName(m_saveList.size(), name); + pl->SetItemName(m_saveList.size(), name); } pl->SetSelect(m_saveList.size()); @@ -4505,7 +4505,7 @@ void CMainDialog::IODeleteScene() } } catch (std::exception & e) { - GetLogger()->Error("Error removing save %s : %s\n", pl->GetName(sel), e.what()); + GetLogger()->Error("Error removing save %s : %s\n", pl->GetItemName(sel), e.what()); } IOReadList(); @@ -4754,7 +4754,7 @@ void CMainDialog::UpdateSceneChap(int &chap) fclose(file); } - pl->SetName(j, name); + pl->SetItemName(j, name); pl->SetEnable(j, true); } } @@ -4807,7 +4807,7 @@ void CMainDialog::UpdateSceneChap(int &chap) bPassed = GetGamerInfoPassed((j+1)*100); sprintf(line, "%d: %s", j+1, name); - pl->SetName(j, line); + pl->SetItemName(j, line); pl->SetCheck(j, bPassed); pl->SetEnable(j, true); @@ -4917,7 +4917,7 @@ void CMainDialog::UpdateSceneList(int chap, int &sel) bPassed = GetGamerInfoPassed((chap+1)*100+(j+1)); sprintf(line, "%d: %s", j+1, name); - pl->SetName(j, line); + pl->SetItemName(j, line); pl->SetCheck(j, bPassed); pl->SetEnable(j, true); @@ -5099,7 +5099,7 @@ void CMainDialog::UpdateDisplayDevice() j = 0; while ( bufDevices[i] != 0 ) { - pl->SetName(j++, bufDevices+i); + pl->SetItemName(j++, bufDevices+i); while ( bufDevices[i++] != 0 ); } @@ -5129,7 +5129,7 @@ void CMainDialog::UpdateDisplayMode() for (Math::IntPoint mode : modes) { mode_text.str(""); mode_text << mode.x << "x" << mode.y; - pl->SetName(i++, mode_text.str().c_str()); + pl->SetItemName(i++, mode_text.str().c_str()); } pl->SetSelect(m_setupSelMode); @@ -5153,12 +5153,12 @@ void CMainDialog::ChangeDisplay() pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST1)); if ( pl == 0 ) return; m_setupSelDevice = pl->GetSelect(); - //device = pl->GetName(m_setupSelDevice); + //device = pl->GetItemName(m_setupSelDevice); pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST2)); if ( pl == 0 ) return; m_setupSelMode = pl->GetSelect(); - //mode = pl->GetName(m_setupSelMode); + //mode = pl->GetItemName(m_setupSelMode); pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL)); if ( pc == 0 ) return; diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp index 52a0ddc..5027924 100644 --- a/src/ui/studio.cpp +++ b/src/ui/studio.cpp @@ -1397,7 +1397,7 @@ void CStudio::UpdateChangeList() pe = static_cast< CEdit* >(pw->SearchControl(EVENT_DIALOG_EDIT)); if ( pe == nullptr ) return; - strcpy(name, pl->GetName(pl->GetSelect())); + strcpy(name, pl->GetItemName(pl->GetSelect())); name[pe->GetMaxChar()] = 0; // truncates according lg max editable p = strchr(name, '\t'); // seeks first tab if ( p != 0 ) *p = 0; @@ -1526,7 +1526,7 @@ void CStudio::UpdateDialogList() std::ostringstream temp; TimeToAscii(fs::last_write_time(file->path()), time); temp << file->path().filename().string() << '\t' << fs::file_size(file->path()) << " \t" << time; - pl->SetName(i++, temp.str().c_str()); + pl->SetItemName(i++, temp.str().c_str()); } } } diff --git a/src/ui/window.cpp b/src/ui/window.cpp index 69ef857..1820642 100644 --- a/src/ui/window.cpp +++ b/src/ui/window.cpp @@ -576,12 +576,12 @@ bool CWindow::GetTooltip(Math::Point pos, std::string &name) // Specifies the name for the title bar. -void CWindow::SetName(std::string name) +void CWindow::SetName(std::string name, bool tooltip) { CButton* pc; bool bAdjust; - CControl::SetName(name); + CControl::SetName(name, tooltip); if ( m_buttonReduce != 0 ) { diff --git a/src/ui/window.h b/src/ui/window.h index e39b8a9..6cb6e5d 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -83,7 +83,7 @@ public: EventType GetEventTypeFull(); EventType GetEventTypeClose(); - void SetName(std::string name); + virtual void SetName(std::string name, bool tooltip = true) override; void SetTrashEvent(bool bTrash); bool GetTrashEvent(); |