Skip to content

Commit a9d0993

Browse files
author
Olivier Butler
committed
improve multiple monitors config
1 parent 5f68ab6 commit a9d0993

File tree

8 files changed

+294
-167
lines changed

8 files changed

+294
-167
lines changed

data/po/fr/strings.po

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ msgid ""
130130
"in speaks my language. Otherwise the ground crew speaks English\n"
131131
"with a local accent."
132132
msgstr ""
133-
"Le personnel au sol parle francais uniquement dans le pays francophones.\n"
133+
"Le personnel au sol parle francais uniquement dans les pays francophones.\n"
134134
"Sinon, Le personnel au sol parle anglais avec un accent local pour certains."
135135

136136
msgid ""
@@ -237,3 +237,42 @@ msgid "Hides default X-Plane 11 pushback tug.\n"
237237
msgstr "Cache le tracteur par defaut de X-Plane 11.\n"
238238
"Relancer X-Plane pour que le changement prenne effet."
239239

240+
msgid "In case of multiple monitors configuration, BpB need to use the primary monitor\n"
241+
"(the one with the x-plane menus), Bpb is able to select it automatically.\n"
242+
"If not select the one that works ! (the monitor numbers are arbitrary)."
243+
msgstr "Dans le cas d'une configuration avec plusieurs ecrans, BpB doit utiliser l'ecran principal\n"
244+
"(celui avec les menus de x-plane), Bpb est capable de le selectionner automatiquement.\n"
245+
"Si ce n'est pas le cas, selectionner celui qui fonctionne ! (La numerotation des ecrans est arbitraire)."
246+
247+
msgid "User interface on monitor #"
248+
msgstr "Interface sur l'ecran n°"
249+
250+
msgid "Automatic"
251+
msgstr "Automatique"
252+
253+
msgid "Monitor #0"
254+
msgstr "Ecran n°0"
255+
256+
msgid "Monitor #1"
257+
msgstr "Ecran n°1"
258+
259+
msgid "Monitor #2"
260+
msgstr "Ecran n°2"
261+
262+
msgid "Monitor #3"
263+
msgstr "Ecran n°3"
264+
265+
msgid "Monitor #4"
266+
msgstr "Ecran n°4"
267+
268+
msgid "Monitor #5"
269+
msgstr "Ecran n°5"
270+
271+
msgid "Magic squares position **"
272+
msgstr "Position des raccourcis **"
273+
274+
msgid "Slide this bar to move the magic squares up or down"
275+
msgstr "Glisser cette barre pour monter ou descendre les miniatures-raccourcis"
276+
277+
msgid "Hide default X-Plane 11 tug"
278+
msgstr "Cache le tracteur par defaut de X-plane"

data/po/strings.pot

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,39 @@ msgid "Don't check the doors and hatches status before starting the push-back"
205205
msgstr ""
206206

207207
msgid "Ignore doors and hatches check **"
208-
msgstr ""
208+
msgstr ""
209+
210+
msgid "In case of multiple monitors configuration, BpB need to use the primary monitor\n"
211+
"(the one with the x-plane menus), Bpb is able to select it automatically.\n"
212+
"If not select the one that works ! (the monitor numbers are arbitrary)."
213+
msgstr ""
214+
215+
msgid "User interface on monitor #"
216+
msgstr ""
217+
218+
msgid "Automatic"
219+
msgstr ""
220+
221+
msgid ""Monitor #0"
222+
msgstr ""
223+
224+
msgid ""Monitor #1"
225+
msgstr ""
226+
227+
msgid ""Monitor #2"
228+
msgstr ""
229+
230+
msgid ""Monitor #3"
231+
msgstr ""
232+
233+
msgid ""Monitor #4"
234+
msgstr ""
235+
236+
msgid ""Monitor #5"
237+
msgstr ""
238+
239+
msgid "Magic squares position **"
240+
msgstr ""
241+
242+
msgid "Slide this bar to move the magic squares up or down"
243+
msgid ""

src/bp.c

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static void disco_intf_hide(void);
190190

191191
static void main_intf_show(void);
192192

193-
static void main_intf_hide(void);
193+
void main_intf_hide(void);
194194

195195
static int disco_handler(XPLMCommandRef, XPLMCommandPhase, void *);
196196

@@ -2454,7 +2454,6 @@ disco_win_draw(XPLMWindowID inWindowID, void *inRefcon) {
24542454
int w, h, mx, my;
24552455

24562456
UNUSED(inRefcon);
2457-
// BPGetScreenSizeUIScaled(&w, &h, B_FALSE);
24582457
h = monitor_def.h;
24592458
w = monitor_def.w;
24602459
XPLMGetMouseLocationGlobal(&mx, &my);
@@ -2569,7 +2568,6 @@ disco_intf_show(void) {
25692568
int w, h;
25702569

25712570
initMonitorOrigin();
2572-
// BPGetScreenSizeUIScaled(&w, &h, B_TRUE);
25732571
h = monitor_def.h;
25742572
w = monitor_def.w;
25752573

@@ -2621,32 +2619,29 @@ main_win_click(XPLMWindowID inWindowID, int x, int y, XPLMMouseStatus inMouse,
26212619

26222620
static void
26232621
main_win_draw(XPLMWindowID inWindowID, void *inRefcon) {
2624-
int h, mx, my;
2622+
int mx, my;
26252623

26262624
UNUSED(inRefcon);
2627-
// BPGetScreenSizeUIScaled(&w, &h, B_FALSE);
2628-
h = monitor_def.h;
2629-
//w = monitor_def.w;
26302625

26312626
XPLMGetMouseLocationGlobal(&mx, &my);
26322627

26332628
XPLMSetGraphicsState(0, 1, 0, 0, 1, 0, 0);
26342629
if (inWindowID == bp_ls.planner_win) {
26352630
bool_t is_lit = (mx >= monitor_def.x_origin &&
26362631
mx <= monitor_def.x_origin + disco_buttons[2].w &&
2637-
my >= monitor_def.y_origin + h/2 - disco_buttons[2].h &&
2638-
my <= monitor_def.y_origin + h/2 );
2632+
my >= monitor_def.y_origin + monitor_def.magic_squares_height - disco_buttons[2].h &&
2633+
my <= monitor_def.y_origin + monitor_def.magic_squares_height );
26392634
draw_icon(&disco_buttons[2], monitor_def.x_origin,
2640-
monitor_def.y_origin + h/2 - disco_buttons[2].h, 1.0,
2635+
monitor_def.y_origin + monitor_def.magic_squares_height - disco_buttons[2].h, 1.0,
26412636
B_FALSE, is_lit);
26422637
} else {
26432638
bool_t is_lit = (mx >= monitor_def.x_origin &&
26442639
mx <= monitor_def.x_origin + disco_buttons[3].w &&
2645-
my >= monitor_def.y_origin + h/2 - 1.5 * disco_buttons[2].h - disco_buttons[3].h &&
2646-
my <= monitor_def.y_origin + h/2 - 1.5 * disco_buttons[2].h);
2640+
my >= monitor_def.y_origin + monitor_def.magic_squares_height - 1.5 * disco_buttons[2].h - disco_buttons[3].h &&
2641+
my <= monitor_def.y_origin + monitor_def.magic_squares_height - 1.5 * disco_buttons[2].h);
26472642
ASSERT(inWindowID == bp_ls.start_pb_win);
26482643
draw_icon(&disco_buttons[3], monitor_def.x_origin,
2649-
monitor_def.y_origin + h/2 - 1.5 * disco_buttons[2].h - disco_buttons[3].h, 1.0,
2644+
monitor_def.y_origin + monitor_def.magic_squares_height - 1.5 * disco_buttons[2].h - disco_buttons[3].h, 1.0,
26502645
B_FALSE, is_lit);
26512646
}
26522647
}
@@ -2664,21 +2659,15 @@ main_intf_show(void) {
26642659
.handleMouseWheelFunc = nil_win_wheel,
26652660
.refcon = NULL
26662661
};
2667-
int h;
26682662
initMonitorOrigin();
2669-
//BPGetScreenSizeUIScaled(&w, &h, B_TRUE);
2670-
h = monitor_def.h;
2671-
//w = monitor_def.w;
2672-
26732663

2674-
logMsg("Orign x %d y %d",monitor_def.x_origin,monitor_def.y_origin );
26752664

26762665
if (bp_ls.planner_win == NULL) {
26772666
load_icon(&disco_buttons[2]);
26782667
disco_ops.left = monitor_def.x_origin ; // w / 2 - 1.5 * disco_buttons[0].w;
26792668
disco_ops.right = monitor_def.x_origin + disco_buttons[2].w;
2680-
disco_ops.top = monitor_def.y_origin + h/2 ; // - 0.5 * disco_buttons[0].h;
2681-
disco_ops.bottom = monitor_def.y_origin + h/2 - disco_buttons[2].h;
2669+
disco_ops.top = monitor_def.y_origin + monitor_def.magic_squares_height ; // - 0.5 * disco_buttons[0].h;
2670+
disco_ops.bottom = monitor_def.y_origin + monitor_def.magic_squares_height - disco_buttons[2].h;
26822671
bp_ls.planner_win = XPLMCreateWindowEx(&disco_ops);
26832672
ASSERT(bp_ls.planner_win != NULL);
26842673
XPLMBringWindowToFront(bp_ls.planner_win);
@@ -2688,7 +2677,7 @@ main_intf_show(void) {
26882677
load_icon(&disco_buttons[3]);
26892678
disco_ops.left = monitor_def.x_origin ; //w / 2 + 0.5 * disco_buttons[1].w;
26902679
disco_ops.right = monitor_def.x_origin + disco_buttons[3].w;
2691-
disco_ops.top = monitor_def.y_origin + h/2 - 1.5 * disco_buttons[2].h;
2680+
disco_ops.top = monitor_def.y_origin + monitor_def.magic_squares_height - 1.5 * disco_buttons[2].h;
26922681
disco_ops.bottom = monitor_def.y_origin + disco_ops.top - disco_buttons[3].h;
26932682
bp_ls.start_pb_win = XPLMCreateWindowEx(&disco_ops);
26942683
ASSERT(bp_ls.start_pb_win != NULL);
@@ -2697,7 +2686,7 @@ main_intf_show(void) {
26972686
}
26982687
}
26992688

2700-
static void
2689+
void
27012690
main_intf_hide(void) {
27022691
if (bp_ls.planner_win != NULL) {
27032692
XPLMDestroyWindow(bp_ls.planner_win);
@@ -2713,7 +2702,8 @@ main_intf_hide(void) {
27132702

27142703
void
27152704
main_intf(void) {
2716-
if (acf_is_airliner() && acf_on_gnd_stopped(NULL) && (start_pb_plan_enable == B_TRUE) && (start_pb_enable == B_TRUE)) {
2705+
if (get_pref_widget_status() // show also the magic button while in the pref window
2706+
|| (acf_is_airliner() && acf_on_gnd_stopped(NULL) && (start_pb_plan_enable == B_TRUE) && (start_pb_enable == B_TRUE))) {
27172707
main_intf_show();
27182708
} else {
27192709
main_intf_hide();

src/bp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ bool_t audio_sys_init(void);
192192

193193
void main_intf(void);
194194

195+
void main_intf_hide(void);
196+
195197
extern bool_t late_plan_requested;
196198

197199
#ifdef __cplusplus

src/bp_cam.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -376,15 +376,11 @@ move_camera(XPLMCommandRef cmd, XPLMCommandPhase phase, void *refcon) {
376376

377377
static void
378378
get_vp(vec4 vp) {
379-
/// int scr_w, scr_h;
380379

381380
ASSERT(vp != NULL);
382-
/*
383-
* As fake_win is defined with 0,0 and sizes given by BPGetScreenSizeUIScaled
384-
* let's do the same here. it will fix planner drawing in Xp12
385-
*/
386-
/// BPGetScreenSizeUIScaled(&scr_w, &scr_h, B_FALSE);
387-
vp[0] = monitor_def.x_origin;
381+
382+
383+
vp[0] = monitor_def.x_origin;
388384
vp[1] = monitor_def.y_origin;
389385
vp[2] = monitor_def.w;
390386
vp[3] = monitor_def.h;
@@ -848,11 +844,10 @@ fake_win_draw(XPLMWindowID inWindowID, void *inRefcon) {
848844
UNUSED(inWindowID);
849845
UNUSED(inRefcon);
850846

851-
//BPGetScreenSizeUIScaled(&w, &h, B_FALSE);
852847
h = monitor_def.h;
853848
w = monitor_def.w;
854849

855-
XPLMSetWindowGeometry(fake_win, monitor_def.x_origin, h, w, monitor_def.y_origin);
850+
// XPLMSetWindowGeometry(fake_win, monitor_def.x_origin, h, w, monitor_def.y_origin);
856851

857852
if (!XPLMIsWindowInFront(fake_win))
858853
XPLMBringWindowToFront(fake_win);
@@ -893,7 +888,6 @@ button_hit_check(int x, int y) {
893888
double scale;
894889
int w, h, h_buttons, h_off;
895890

896-
// BPGetScreenSizeUIScaled(&w, &h, B_FALSE);
897891
h = monitor_def.h;
898892
w = monitor_def.w;
899893

@@ -1209,7 +1203,6 @@ bp_cam_start(void) {
12091203

12101204
push_reset_fov_values();
12111205
eye_track_debut();
1212-
// BPGetScreenSizeUIScaled(&fake_win_ops.right, &fake_win_ops.top, B_TRUE);
12131206

12141207
initMonitorOrigin();
12151208
fake_win_ops.left = monitor_def.x_origin;
@@ -1286,11 +1279,9 @@ bp_cam_start(void) {
12861279

12871280
updateAvailable = getPluginUpdateStatus();
12881281
if (updateAvailable != NULL) {
1289-
// snprintf(bottom_msg, sizeof(bottom_msg), "New version of BetterPushBack available: %s (Use SkunkCrafts Updater to update)", updateAvailable);
1290-
// init_bottom_msg(bottom_msg);
1291-
}
1292-
snprintf(bottom_msg, sizeof(bottom_msg), "New version of BetterPushBack available: xxxx (Use SkunkCrafts Updater to update)");
1282+
snprintf(bottom_msg, sizeof(bottom_msg), "New version of BetterPushBack available: %s (Use SkunkCrafts Updater to update)", updateAvailable);
12931283
init_bottom_msg(bottom_msg);
1284+
}
12941285

12951286
return (B_TRUE);
12961287
}

src/cab_view.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,9 @@ cam_ctl(XPLMCameraPosition_t *pos, int losing_control, void *refcon)
199199
static void
200200
win_draw(XPLMWindowID inWindowID, void *inRefcon)
201201
{
202-
// int w, h;
203202

204203
UNUSED(inWindowID);
205204
UNUSED(inRefcon);
206-
// BPGetScreenSizeUIScaled(&w, &h, B_FALSE);
207205
XPLMSetWindowGeometry(win, monitor_def.x_origin, monitor_def.h, monitor_def.w, monitor_def.y_origin);
208206

209207
if (hintbar != NULL && microclock() - hintbar_start > HINTBAR_TIMEOUT) {
@@ -330,7 +328,6 @@ cab_view_start(void)
330328
.handleMouseWheelFunc = win_wheel,
331329
.refcon = NULL
332330
};
333-
// BPGetScreenSizeUIScaled(&win_ops.right, &win_ops.top, B_TRUE);
334331
win_ops.left = monitor_def.x_origin;
335332
win_ops.right = monitor_def.x_origin + monitor_def.w;
336333
win_ops.bottom = monitor_def.y_origin;
@@ -347,12 +344,10 @@ cab_view_start(void)
347344
*/
348345
if (hintbar == NULL) {
349346
const char *str = _("Left mouse button to reorient view");
350-
// int x, y;
351347
int w = XPLMMeasureString(xplmFont_Proportional,
352348
str, strlen(str));
353349
XPWidgetID caption;
354350

355-
// BPGetScreenSizeUIScaled(&x, &y, B_TRUE);
356351
hintbar = create_widget_rel((monitor_def.w - w) / 2 - 10,
357352
HINTBAR_HEIGHT * 3, B_FALSE, w + 20,
358353
HINTBAR_HEIGHT, 0, "", 1, NULL, xpWidgetClass_MainWindow);

0 commit comments

Comments
 (0)