Skip to content

Commit

Permalink
Fix : Sugar setup menu + configuration selection
Browse files Browse the repository at this point in the history
Need some cleanup & population of configurations !
  • Loading branch information
Tom1975 committed Oct 26, 2024
1 parent 0d2236b commit dcdd630
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
11 changes: 9 additions & 2 deletions src/CheckMenuItemWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,18 @@ void CheckMenuItemWindows::RedrawWindow()
if (focus_ == this)
{
// draw it
display_->WriteText("*", x - 15, y);
display_->SelectFont(fnt_italic_);
display_->SelectColor(0xFF0000);
}
else
{
display_->SelectFont(fnt_normal_);
display_->SelectColor(0x000000);
}

// Draw the check box
display_->WriteText((*value_) ? "[X]" : "[ ]", x, y);
display_->WriteText(label_, x + 30, y);
display_->WriteText(label_, x + 60, y);
}

IAction::ActionReturn CheckMenuItemWindows::HandleEvent(IEvent::Event event)
Expand Down
17 changes: 9 additions & 8 deletions src/ScreenMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,34 +219,34 @@ IAction::ActionReturn ScreenMenu::SelectAmstrad()
// Create menu from config_list
Window* focus = Window::GetFocus();

MainMenuWindows* file_menu = new MainMenuWindows(display_->GetMenuFrame());
MainMenuWindows* cfg_menu = new MainMenuWindows(display_->GetMenuFrame());

file_menu->GetMenu()->AddMenuItem("..", 10, 0, main_menu_->GetMenu()->GetWidth() - 10, INTERLINE_SPACE - 2
cfg_menu->GetMenu()->AddMenuItem("..", 10, 0, main_menu_->GetMenu()->GetWidth() - 10, INTERLINE_SPACE - 2
, new ActionMenu(this, &ScreenMenu::Back));


int offset_y = INTERLINE_SPACE + 2;
for (auto& it : config_list)
{
MenuButtonWithBitmapWindows* item = new MenuButtonWithBitmapWindows(display_->GetMenuFrame());
item->Create(it.name_.c_str(), &it.associatedBmp_, file_menu->GetMenu()->GetScrollWindow(), 10, offset_y,
item->Create(it.name_.c_str(), &it.associatedBmp_, cfg_menu->GetMenu()->GetScrollWindow(), 10, offset_y,
main_menu_->GetMenu()->GetWidth() - 600, INTERLINE_SPACE,
main_menu_->GetMenu()->GetWidth() - 600, INTERLINE_SPACE + 2 , 600, 400);
item->SetAction(new ActionMenuWithParameter<ScreenMenu::AmstradConfiguration&>(this, &ScreenMenu::SelectAmstradFinal, it));

file_menu->GetMenu()->AddMenuItem(item);
cfg_menu->GetMenu()->AddMenuItem(item);


offset_y += INTERLINE_SPACE +2;
}

file_menu->ResetMenu();
cfg_menu->ResetMenu();

IAction::ActionReturn return_value = file_menu->DoScreen(this);
IAction::ActionReturn return_value = cfg_menu->DoScreen(this);

logger_->Write("Menu", LogNotice, "file_menu->DoScreen : %i", return_value);

delete file_menu;
delete cfg_menu;
Window::SetFocus(focus);
main_menu_->Invalidate();

Expand Down Expand Up @@ -588,8 +588,9 @@ IAction::ActionReturn ScreenMenu::SugarSetup()

// Add Synchro menu
bool sync = display_-> IsSyncOnFrame();
int offset_y = 60 + 2;
setup_menu->GetMenu()->AddCheckMenuItem("Set synchro on Frame", &sync,
10, INTERLINE_SPACE, main_menu_->GetMenu()->GetWidth() - 10, INTERLINE_SPACE - 2,
10, offset_y, main_menu_->GetMenu()->GetWidth() - 10, INTERLINE_SPACE - 2,
new ActionMenuWithParameter<bool*>(this, &ScreenMenu::SetSync, &sync));

setup_menu->ResetMenu ();
Expand Down
3 changes: 2 additions & 1 deletion src/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ void Window::Redraw (bool clear)
DWORD elapsed = (DWORD)(((s2 - s3) * 1000000) / freq);
if (elapsed > 1000000)
{
sprintf(s, "FPS : %f\n", nb_frame / (elapsed /1000000.0));
//sprintf(s, "FPS : %f\n", nb_frame / (elapsed /1000000.0));
sprintf(s, "Time for a frame : %i\n", elapsed / 1000000);
OutputDebugString(s);
s3 = s2;
nb_frame = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Window
virtual void RedrawWindow ();
virtual void RedrawChildren ();

virtual void ShowWindow(bool visible) { visible_ = visible; Invalidate(); }
virtual void ShowWindow(bool visible) { visible_ = visible; }
virtual bool IsVisible() { return visible_; }

virtual void DrawBitmap(PiBitmap* bmp, int x, int y);
Expand Down

0 comments on commit dcdd630

Please sign in to comment.