Skip to content

Commit

Permalink
ui: replace all ImGuiCond_Once with ImGuiCond_FirstUseEver
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Dec 11, 2024
1 parent 9473d6b commit 3bbeb8b
Show file tree
Hide file tree
Showing 26 changed files with 110 additions and 111 deletions.
4 changes: 2 additions & 2 deletions ui/ui_am40010.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ void ui_am40010_draw(ui_am40010_t* win) {
if (!win->open) {
return;
}
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_FirstUseEver);
if (ImGui::Begin(win->title, &win->open)) {
ImGui::BeginChild("##chip", ImVec2(176, 0), true);
ui_chip_draw(&win->chip, win->am40010->pins);
Expand Down
10 changes: 5 additions & 5 deletions ui/ui_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
~~~C
#define CHIPS_UI_IMPL
~~~
before you include this file in *one* C++ file to create the
before you include this file in *one* C++ file to create the
implementation.
Optionally provide the following macros with your own implementation
~~~C
CHIPS_ASSERT(c)
~~~
Expand Down Expand Up @@ -40,7 +40,7 @@
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
distribution.
#*/
#include <stdint.h>
#include <stdbool.h>
Expand Down Expand Up @@ -119,8 +119,8 @@ void ui_audio_draw(ui_audio_t* win, int sample_pos) {
if (!win->open) {
return;
}
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_FirstUseEver);
if (ImGui::Begin(win->title, &win->open)) {
ImVec2 pos = ImGui::GetCursorScreenPos();
ImVec2 area = ImGui::GetContentRegionAvail();
Expand Down
10 changes: 5 additions & 5 deletions ui/ui_ay38910.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
~~~C
#define CHIPS_UI_IMPL
~~~
before you include this file in *one* C++ file to create the
before you include this file in *one* C++ file to create the
implementation.
Optionally provide the following macros with your own implementation
~~~C
CHIPS_ASSERT(c)
~~~
Expand Down Expand Up @@ -47,7 +47,7 @@
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
distribution.
#*/
#include <stdint.h>
#include <stdbool.h>
Expand Down Expand Up @@ -204,8 +204,8 @@ void ui_ay38910_draw(ui_ay38910_t* win) {
if (!win->open) {
return;
}
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_FirstUseEver);
if (ImGui::Begin(win->title, &win->open)) {
ImGui::BeginChild("##ay_chip", ImVec2(176, 0), true);
ui_chip_draw(&win->chip, win->ay->pins);
Expand Down
4 changes: 2 additions & 2 deletions ui/ui_bombjack.h
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,8 @@ static void _ui_bombjack_draw_video(ui_bombjack_t* ui) {
if (!ui->video.open) {
return;
}
ImGui::SetNextWindowPos(ImVec2((float)ui->video.x, (float)ui->video.y), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2((float)ui->video.w, (float)ui->video.h), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2((float)ui->video.x, (float)ui->video.y), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2((float)ui->video.w, (float)ui->video.h), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Video Hardware", &ui->video.open)) {
if (ImGui::CollapsingHeader("Layers")) {
ImGui::Checkbox("Clear Background Layer", &ui->bj->dbg.clear_background_layer);
Expand Down
10 changes: 5 additions & 5 deletions ui/ui_c1530.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
~~~C
#define CHIPS_UI_IMPL
~~~
before you include this file in *one* C++ file to create the
before you include this file in *one* C++ file to create the
implementation.
Optionally provide the following macros with your own implementation
~~~C
CHIPS_ASSERT(c)
~~~
Expand All @@ -39,7 +39,7 @@
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
distribution.
#*/
#include <stdint.h>
#include <stdbool.h>
Expand Down Expand Up @@ -111,8 +111,8 @@ void ui_c1530_draw(ui_c1530_t* win) {
if (!win->open) {
return;
}
ImGui::SetNextWindowPos({win->init_x, win->init_y}, ImGuiCond_Once);
ImGui::SetNextWindowSize({win->init_w, win->init_h}, ImGuiCond_Once);
ImGui::SetNextWindowPos({win->init_x, win->init_y}, ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize({win->init_w, win->init_h}, ImGuiCond_FirstUseEver);
if (ImGui::Begin(win->title, &win->open)) {
c1530_t* sys = win->c1530;
CHIPS_ASSERT(sys && sys->cas_port);
Expand Down
12 changes: 6 additions & 6 deletions ui/ui_dasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
~~~C
#define CHIPS_UI_IMPL
~~~
before you include this file in *one* C++ file to create the
before you include this file in *one* C++ file to create the
implementation.
Select the supported CPUs with the following macros (at least
Expand All @@ -18,7 +18,7 @@
UI_DASM_USE_M6502
Optionally provide the following macros with your own implementation
~~~C
CHIPS_ASSERT(c)
~~~
Expand Down Expand Up @@ -51,7 +51,7 @@
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
distribution.
#*/
#include <stdint.h>
#include <stdbool.h>
Expand Down Expand Up @@ -275,7 +275,7 @@ static bool _ui_dasm_jumptarget(ui_dasm_t* win, uint16_t pc, uint16_t* out_addr)
else if (win->bin_pos == 2) {
switch (win->bin_buf[0]) {
/* relative branch */
case 0x10: case 0x30: case 0x50: case 0x70:
case 0x10: case 0x30: case 0x50: case 0x70:
case 0x90: case 0xB0: case 0xD0: case 0xF0:
*out_addr = pc + (int8_t)win->bin_buf[1];
return true;
Expand Down Expand Up @@ -442,8 +442,8 @@ void ui_dasm_draw(ui_dasm_t* win) {
if (!win->open) {
return;
}
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_FirstUseEver);
if (ImGui::Begin(win->title, &win->open)) {
_ui_dasm_draw_stack(win);
ImGui::SameLine();
Expand Down
20 changes: 10 additions & 10 deletions ui/ui_dbg.h
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,8 @@ static void _ui_dbg_history_draw(ui_dbg_t* win) {
if (!win->ui.show_history) {
return;
}
ImGui::SetNextWindowPos(ImVec2(win->ui.init_x + win->ui.init_w, win->ui.init_y + 64), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(win->ui.init_w, 376), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->ui.init_x + win->ui.init_w, win->ui.init_y + 64), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(win->ui.init_w, 376), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Execution History", &win->ui.show_history)) {
const float line_height = ImGui::GetTextLineHeight();
ImGui::SetNextWindowContentSize(ImVec2(0, UI_DBG_NUM_HISTORY_ITEMS * line_height));
Expand Down Expand Up @@ -951,8 +951,8 @@ static void _ui_dbg_bp_draw(ui_dbg_t* win) {
if (!win->ui.show_breakpoints) {
return;
}
ImGui::SetNextWindowPos(ImVec2(win->ui.init_x + win->ui.init_w, win->ui.init_y), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(-1, 256), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->ui.init_x + win->ui.init_w, win->ui.init_y), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(-1, 256), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Breakpoints", &win->ui.show_breakpoints)) {
bool scroll_down = false;
if (ImGui::Button("Add..")) {
Expand Down Expand Up @@ -1211,8 +1211,8 @@ static void _ui_dbg_heatmap_draw(ui_dbg_t* win) {
}
}
_ui_dbg_heatmap_update(win);
ImGui::SetNextWindowPos(ImVec2(win->ui.init_x + win->ui.init_w, win->ui.init_y + 128), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(292, 400), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->ui.init_x + win->ui.init_w, win->ui.init_y + 128), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(292, 400), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Memory Heatmap", &win->ui.show_heatmap)) {
if (ImGui::Button("Clear All")) {
_ui_dbg_heatmap_clear_all(win);
Expand Down Expand Up @@ -1320,8 +1320,8 @@ static void _ui_dbg_stopwatch_draw(ui_dbg_t* win) {
if (!win->ui.show_stopwatch) {
return;
}
ImGui::SetNextWindowPos(ImVec2(win->ui.init_x + win->ui.init_w, win->ui.init_y), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(-1, -1), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->ui.init_x + win->ui.init_w, win->ui.init_y), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(-1, -1), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Stopwatch", &win->ui.show_stopwatch)) {
for (int i = 0; i < UI_DBG_STOPWATCH_NUM; i++) {
ImGui::PushID(i);
Expand Down Expand Up @@ -1919,8 +1919,8 @@ static void _ui_dbg_dbgwin_draw(ui_dbg_t* win) {
if (!win->ui.open) {
return;
}
ImGui::SetNextWindowPos(ImVec2(win->ui.init_x, win->ui.init_y), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(win->ui.init_w, win->ui.init_h), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->ui.init_x, win->ui.init_y), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(win->ui.init_w, win->ui.init_h), ImGuiCond_FirstUseEver);
if (ImGui::Begin(win->ui.title, &win->ui.open, ImGuiWindowFlags_MenuBar)) {
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) {
ImGui::SetNextFrameWantCaptureKeyboard(true);
Expand Down
10 changes: 5 additions & 5 deletions ui/ui_fdd.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
~~~C
#define CHIPS_UI_IMPL
~~~
before you include this file in *one* C++ file to create the
before you include this file in *one* C++ file to create the
implementation.
Optionally provide the following macros with your own implementation
~~~C
CHIPS_ASSERT(c)
~~~
Expand Down Expand Up @@ -46,7 +46,7 @@
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
distribution.
#*/
#include <stdint.h>
#include <stdbool.h>
Expand Down Expand Up @@ -120,8 +120,8 @@ void ui_fdd_draw(ui_fdd_t* win) {
if (!win->open) {
return;
}
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_FirstUseEver);
if (ImGui::Begin(win->title, &win->open)) {
if (ImGui::CollapsingHeader("Drive Status", ImGuiTreeNodeFlags_DefaultOpen)) {
fdd_t* fdd = win->fdd;
Expand Down
10 changes: 5 additions & 5 deletions ui/ui_i8255.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
~~~C
#define CHIPS_UI_IMPL
~~~
before you include this file in *one* C++ file to create the
before you include this file in *one* C++ file to create the
implementation.
Optionally provide the following macros with your own implementation
~~~C
CHIPS_ASSERT(c)
~~~
Expand Down Expand Up @@ -46,7 +46,7 @@
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
distribution.
#*/
#include <stdint.h>
#include <stdbool.h>
Expand Down Expand Up @@ -155,8 +155,8 @@ void ui_i8255_draw(ui_i8255_t* win) {
if (!win->open) {
return;
}
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_FirstUseEver);
if (ImGui::Begin(win->title, &win->open)) {
ImGui::BeginChild("##i8255_chip", ImVec2(176, 0), true);
ui_chip_draw(&win->chip, win->i8255->pins);
Expand Down
10 changes: 5 additions & 5 deletions ui/ui_kbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
~~~C
#define CHIPS_UI_IMPL
~~~
before you include this file in *one* C++ file to create the
before you include this file in *one* C++ file to create the
implementation.
Optionally provide the following macros with your own implementation
~~~C
CHIPS_ASSERT(c)
~~~
Expand Down Expand Up @@ -44,7 +44,7 @@
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
distribution.
#*/
#include <stdint.h>
#include <stdbool.h>
Expand Down Expand Up @@ -271,10 +271,10 @@ void ui_kbd_draw(ui_kbd_t* win) {
if (!win->open) {
return;
}
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_FirstUseEver);
const float min_w = win->num_columns * win->cell_width + win->left_padding + 40.0f;
const float min_h = win->num_lines * win->cell_height + win->top_padding + 64.0f;
ImGui::SetNextWindowSize(ImVec2(min_w, min_h), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(min_w, min_h), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSizeConstraints(ImVec2(min_w, min_h), ImVec2(FLT_MAX, FLT_MAX));
if (ImGui::Begin(win->title, &win->open)) {
_ui_kbd_draw_plane_combo(win);
Expand Down
4 changes: 2 additions & 2 deletions ui/ui_kc85sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ void ui_kc85sys_draw(ui_kc85sys_t* win) {
if (!win->open) {
return;
}
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_FirstUseEver);
if (ImGui::Begin(win->title, &win->open)) {
if (ImGui::CollapsingHeader("Port 88h (PIO A)", ImGuiTreeNodeFlags_DefaultOpen)) {
const uint64_t v = win->kc85->pio_pins;
Expand Down
10 changes: 5 additions & 5 deletions ui/ui_m6502.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
~~~C
#define CHIPS_UI_IMPL
~~~
before you include this file in *one* C++ file to create the
before you include this file in *one* C++ file to create the
implementation.
Optionally provide the following macros with your own implementation
~~~C
CHIPS_ASSERT(c)
~~~
Expand Down Expand Up @@ -47,7 +47,7 @@
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
distribution.
#*/
#include <stdint.h>
#include <stdbool.h>
Expand Down Expand Up @@ -156,8 +156,8 @@ void ui_m6502_draw(ui_m6502_t* win) {
if (!win->open) {
return;
}
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_Once);
ImGui::SetNextWindowPos(ImVec2(win->init_x, win->init_y), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(win->init_w, win->init_h), ImGuiCond_FirstUseEver);
if (ImGui::Begin(win->title, &win->open)) {
ImGui::BeginChild("##m6502_chip", ImVec2(176, 0), true);
ui_chip_draw(&win->chip, win->cpu->PINS);
Expand Down
Loading

0 comments on commit 3bbeb8b

Please sign in to comment.