Skip to content

Commit

Permalink
#589 Prevent some of the overlapping with lower scale factors
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Jun 11, 2022
1 parent d165a40 commit c00d460
Show file tree
Hide file tree
Showing 7 changed files with 270 additions and 268 deletions.
12 changes: 6 additions & 6 deletions dialogs/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ pub struct ResourceHeader {

impl Display for ResourceHeader {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
writeln!(f, "#define Y_SCALE {}", self.y_scale)?;
writeln!(f, "#define HEIGHT_SCALE {}", self.height_scale)?;
writeln!(f, "#define Y_SCALE {:.4}", self.y_scale)?;
writeln!(f, "#define HEIGHT_SCALE {:.4}", self.height_scale)?;
for id in &self.named_ids {
writeln!(f, "#define {} {}", id.name, id.value)?;
}
Expand Down Expand Up @@ -338,10 +338,10 @@ pub struct Dimensions(pub u32, pub u32);

#[derive(Copy, Clone, Default)]
pub struct Rect {
x: u32,
y: u32,
width: u32,
height: u32,
pub x: u32,
pub y: u32,
pub width: u32,
pub height: u32,
}

impl Display for Rect {
Expand Down
3 changes: 2 additions & 1 deletion dialogs/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ pub fn dropdown(id: Id, rect: Rect) -> Control {

pub fn checkbox(caption: Caption, id: Id, rect: Rect) -> Control {
use Style::*;
control(caption, id, SubControlKind::Button, rect) + BS_AUTOCHECKBOX
let fixed_rect = Rect { height: 10, ..rect };
control(caption, id, SubControlKind::Button, fixed_rect) + BS_AUTOCHECKBOX
}

pub fn slider(id: Id, rect: Rect) -> Control {
Expand Down
2 changes: 1 addition & 1 deletion dialogs/src/mapping_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::ext::*;
pub fn create(context: &mut Context) -> Dialog {
use Style::*;
let mapping_controls = [
groupbox("Mapping", context.id(), context.rect(7, 7, 435, 60)),
groupbox("Mapping", context.id(), context.rect(7, 3, 435, 64)),
ltext("Feedback", context.id(), context.rect(11, 53, 34, 9)) + NOT_WS_GROUP,
combobox(
context.named_id("ID_MAPPING_FEEDBACK_SEND_BEHAVIOR_COMBO_BOX"),
Expand Down
23 changes: 12 additions & 11 deletions dialogs/src/shared_group_mapping_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::ext::*;

pub fn create(context: &mut Context) -> Dialog {
use Style::*;
let line_2_y = 20;
let controls = vec![
// Name
ltext("Name", context.id(), context.rect(5, 6, 20, 9)) + NOT_WS_GROUP,
Expand Down Expand Up @@ -33,59 +34,59 @@ pub fn create(context: &mut Context) -> Dialog {
ltext(
"Active",
context.named_id("ID_MAPPING_ACTIVATION_LABEL"),
context.rect(5, 24, 21, 9),
context.rect(5, line_2_y + 2, 21, 9),
) + NOT_WS_GROUP,
dropdown(
context.named_id("ID_MAPPING_ACTIVATION_TYPE_COMBO_BOX"),
context.rect(33, 22, 102, 15),
context.rect(33, line_2_y, 102, 15),
) + WS_TABSTOP,
// Conditional activation criteria 1
ltext(
"Modifier 1",
context.named_id("ID_MAPPING_ACTIVATION_SETTING_1_LABEL_TEXT"),
context.rect(143, 24, 33, 9),
context.rect(143, line_2_y + 2, 33, 9),
) + NOT_WS_GROUP,
dropdown(
context.named_id("ID_MAPPING_ACTIVATION_SETTING_1_COMBO_BOX"),
context.rect(182, 22, 90, 15),
context.rect(182, line_2_y, 90, 15),
) + WS_VSCROLL
+ WS_TABSTOP,
checkbox(
"",
context.named_id("ID_MAPPING_ACTIVATION_SETTING_1_CHECK_BOX"),
context.rect(276, 24, 11, 8),
context.rect(276, line_2_y + 2, 11, 8),
) + WS_TABSTOP,
// Conditional activation criteria 2
ltext(
"Modifier 2",
context.named_id("ID_MAPPING_ACTIVATION_SETTING_2_LABEL_TEXT"),
context.rect(292, 24, 34, 9),
context.rect(292, line_2_y + 2, 34, 9),
) + NOT_WS_GROUP,
dropdown(
context.named_id("ID_MAPPING_ACTIVATION_SETTING_2_COMBO_BOX"),
context.rect(330, 22, 90, 15),
context.rect(330, line_2_y, 90, 15),
) + WS_VSCROLL
+ WS_TABSTOP,
checkbox(
"",
context.named_id("ID_MAPPING_ACTIVATION_SETTING_2_CHECK_BOX"),
context.rect(424, 24, 11, 8),
context.rect(424, line_2_y + 2, 11, 8),
) + WS_TABSTOP,
ltext(
"EEL (e.g. y = p1 > 0)",
context.named_id("ID_MAPPING_ACTIVATION_EEL_LABEL_TEXT"),
context.rect(143, 24, 70, 9),
context.rect(143, line_2_y + 2, 70, 9),
) + NOT_WS_GROUP,
edittext(
context.named_id("ID_MAPPING_ACTIVATION_EDIT_CONTROL"),
context.rect(213, 22, 220, 14),
context.rect(213, line_2_y, 220, 14),
) + ES_MULTILINE
+ ES_AUTOHSCROLL,
];
Dialog {
id: context.named_id("ID_SHARED_GROUP_MAPPING_PANEL"),
kind: DialogKind::DIALOGEX,
rect: context.rect(0, 0, 440, 40),
rect: context.rect(0, 0, 440, 37),
styles: Styles(vec![
DS_SETFONT, DS_CONTROL, DS_CENTER, WS_CHILD, WS_VISIBLE, WS_SYSMENU,
]),
Expand Down
4 changes: 2 additions & 2 deletions main/src/infrastructure/ui/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
pub mod root {
#[allow(unused_imports)]
use self::super::root;
pub const Y_SCALE: f64 = 0.8;
pub const HEIGHT_SCALE: f64 = 0.8;
pub const Y_SCALE: f64 = 1.0;
pub const HEIGHT_SCALE: f64 = 1.0;
pub const ID_GROUP_PANEL: u32 = 30000;
pub const ID_GROUP_PANEL_OK: u32 = 30001;
pub const ID_HEADER_PANEL: u32 = 30040;
Expand Down
4 changes: 2 additions & 2 deletions main/src/infrastructure/ui/msvc/Resource.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define Y_SCALE 0.8
#define HEIGHT_SCALE 0.8
#define Y_SCALE 1.0000
#define HEIGHT_SCALE 1.0000
#define ID_GROUP_PANEL 30000
#define ID_GROUP_PANEL_OK 30001
#define ID_HEADER_PANEL 30040
Expand Down
Loading

0 comments on commit c00d460

Please sign in to comment.