Skip to content

Commit

Permalink
directvt#396 Add preferred window control buttons location option (co…
Browse files Browse the repository at this point in the history
…nfig/appearance/defaults/macstyle)
  • Loading branch information
o-sdn-o committed Sep 17, 2023
1 parent 1b2475a commit b45f4df
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/netxs/desktopio/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,20 @@ namespace netxs::app::shared
auto highlight_color = skin::color(tone::highlight);
auto danger_color = skin::color(tone::danger);
auto action_color = skin::color(tone::action);
auto warning_color = skin::color(tone::warning);
auto c6 = action_color;
auto x6 = cell{ c6 }.alpha(0x00);
auto c3 = highlight_color;
auto x3 = cell{ c3 }.alpha(0x00);
auto c2 = warning_color;
auto x2 = cell{ c2 }.bga(0x00);
auto c1 = danger_color;
auto x1 = cell{ c1 }.alpha(0x00);

auto slot1 = ui::veer::ctor();
auto menuarea = ui::fork::ctor()->active();
auto fader = skin::globals().fader_time;
auto macstyle = skin::globals().macstyle;

auto make_item = [&](auto& body, auto& dest_ptr, auto& fgc, auto& bgc)
{
Expand All @@ -140,7 +144,9 @@ namespace netxs::app::shared
};
});
};
auto tailitem = menuarea->attach(slot::_2, ui::pads::ctor(dent{ 1,0,1,1 }, dent{ 0 }));
auto ctrlslot = macstyle ? slot::_1 : slot::_2;
auto menuslot = macstyle ? slot::_2 : slot::_1;
auto tailitem = menuarea->attach(ctrlslot, ui::pads::ctor(dent{ 1,0,1,1 }, dent{ 0 }));
auto bttnlist = tailitem->attach(ui::list::ctor(axis::X));
auto innerpad = dent{ 1,2,1,1 };
auto outerpad = dent{ 1 };
Expand All @@ -155,7 +161,7 @@ namespace netxs::app::shared
}
else // Add standard menu controls.
{
auto control = list
auto control = std::vector<link>
{
{ ptr::shared(menu::item{ menu::item::type::Command, true, 0, std::vector<menu::item::look>{ { .label = "", .notes = " Minimize " } }}),
[](ui::pads& boss, auto& item)
Expand Down Expand Up @@ -186,15 +192,23 @@ namespace netxs::app::shared
};
}},
};
auto iter = control.begin();
auto mid_item1 = bttnlist->attach(ui::pads::ctor(innerpad, outerpad));
auto mid_item2 = bttnlist->attach(ui::pads::ctor(innerpad, outerpad));
auto mid_item3 = bttnlist->attach(ui::pads::ctor(innerpad, outerpad));
make_item(*iter++, mid_item1, x3, c3);
make_item(*iter++, mid_item2, x3, c3);
make_item(*iter++, mid_item3, x1, c1);
if (macstyle)
{
make_item(control[2], mid_item1, x1, c1);
make_item(control[0], mid_item2, x2, c2);
make_item(control[1], mid_item3, x6, c6);
}
else
{
make_item(control[0], mid_item1, x3, c3);
make_item(control[1], mid_item2, x3, c3);
make_item(control[2], mid_item3, x1, c1);
}
}
auto headarea = menuarea->attach(slot::_1, ui::pads::ctor(dent{ 0,0,1,1 }, dent{ 0 }));
auto headarea = menuarea->attach(menuslot, ui::pads::ctor(dent{ 0,0,1,1 }, dent{ 0 }));
auto scrlarea = headarea->attach(ui::cake::ctor());
auto scrlrail = scrlarea->attach(ui::rail::ctor(axes::X_only, axes::all));
auto scrllist = scrlrail->attach(ui::list::ctor(axis::X));
Expand Down
1 change: 1 addition & 0 deletions src/netxs/desktopio/baseui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ namespace netxs::ui
si32 lucidity = 0xFF;
bool tracking = faux;
bool menuwide = faux;
bool macstyle = faux;

si32 spd;
si32 pls;
Expand Down
1 change: 1 addition & 0 deletions src/netxs/desktopio/console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3672,6 +3672,7 @@ namespace netxs::ui
g.lucidity = config.take("lucidity");
g.tracking = config.take("tracking" , faux);
g.bordersz = config.take("bordersz" , dot_11);
g.macstyle = config.take("macstyle" , faux);
g.spd = config.take("timings/spd" , 10 );
g.pls = config.take("timings/pls" , 167 );
g.spd_accel = config.take("timings/spd_accel" , 1 );
Expand Down
1 change: 1 addition & 0 deletions src/vtm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ R"==(
<bordersz = 1,1 />
<lucidity = 0xff /> <!-- not implemented -->
<tracking = off /> <!-- Mouse cursor highlighting. -->
<macstyle = no /> <!-- Preferred window control buttons location. no: right corner (like on MS Windows), yes: left side (like on macOS) -->
<brighter fgc=purewhite bgc=purewhite alpha=60 /> <!-- Highlighter. -->
<kb_focus fgc=bluelt bgc=bluelt alpha=60 /> <!-- Keyboard focus indicator. -->
<shadower bgc=0xB4202020 /> <!-- Darklighter. -->
Expand Down

0 comments on commit b45f4df

Please sign in to comment.