Changes in uspace/app/taskbar-cfg/smeedit.c [806d761:f87ff8e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskbar-cfg/smeedit.c
r806d761 rf87ff8e 1 1 /* 2 * Copyright (c) 202 4Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 36 36 #include <stdio.h> 37 37 #include <stdlib.h> 38 #include <ui/checkbox.h>39 38 #include <ui/fixed.h> 40 39 #include <ui/resource.h> … … 95 94 const char *cmd; 96 95 const char *caption; 97 bool terminal;98 96 errno_t rc; 99 97 … … 103 101 cmd = smenu_entry_get_cmd(smentry->entry); 104 102 caption = smenu_entry_get_caption(smentry->entry); 105 terminal = smenu_entry_get_terminal(smentry->entry);106 103 } else { 107 104 cmd = ""; 108 105 caption = ""; 109 terminal = false;110 106 } 111 107 … … 120 116 121 117 ui_wnd_params_init(¶ms); 122 params.caption = smentry != NULL ? "Edit Start Menu Entry" :123 "Create Start Menu Entry";118 params.caption = smentry != NULL ? "Edit Start Menu Entry" 119 : "Create Start Menu Entry"; 124 120 if (ui_is_textmode(ui)) { 125 121 params.rect.p0.x = 0; 126 122 params.rect.p0.y = 0; 127 123 params.rect.p1.x = 50; 128 params.rect.p1.y = 1 3;124 params.rect.p1.y = 12; 129 125 } else { 130 126 params.rect.p0.x = 0; 131 127 params.rect.p0.y = 0; 132 128 params.rect.p1.x = 370; 133 params.rect.p1.y = 2 30;129 params.rect.p1.y = 200; 134 130 } 135 131 … … 259 255 } 260 256 261 /* Start in terminal checkbox*/262 263 rc = ui_ checkbox_create(res, "Start in terminal", &smee->cbterminal);264 if (rc != EOK) 265 goto error; 266 267 /* FIXME: Auto layout */ 268 if (ui_is_textmode(ui)) { 269 rect.p0.x = 3;270 rect.p0.y = 8;271 rect.p1.x = 6;272 rect.p1.y = 9;273 } else { 274 rect.p0.x = 1 0;257 /* OK button */ 258 259 rc = ui_pbutton_create(res, "OK", &smee->bok); 260 if (rc != EOK) 261 goto error; 262 263 /* FIXME: Auto layout */ 264 if (ui_is_textmode(ui)) { 265 rect.p0.x = 23; 266 rect.p0.y = 9; 267 rect.p1.x = 35; 268 rect.p1.y = 10; 269 } else { 270 rect.p0.x = 190; 275 271 rect.p0.y = 155; 276 rect.p1.x = 360;277 rect.p1.y = 170;278 }279 280 ui_checkbox_set_rect(smee->cbterminal, &rect);281 ui_checkbox_set_checked(smee->cbterminal, terminal);282 283 rc = ui_fixed_add(smee->fixed, ui_checkbox_ctl(smee->cbterminal));284 if (rc != EOK) {285 printf("Error adding control to layout.\n");286 goto error;287 }288 289 /* OK button */290 291 rc = ui_pbutton_create(res, "OK", &smee->bok);292 if (rc != EOK)293 goto error;294 295 /* FIXME: Auto layout */296 if (ui_is_textmode(ui)) {297 rect.p0.x = 23;298 rect.p0.y = 10;299 rect.p1.x = 35;300 rect.p1.y = 11;301 } else {302 rect.p0.x = 190;303 rect.p0.y = 190;304 272 rect.p1.x = 270; 305 rect.p1.y = 215;273 rect.p1.y = 180; 306 274 } 307 275 … … 325 293 if (ui_is_textmode(ui)) { 326 294 rect.p0.x = 36; 327 rect.p0.y = 10;295 rect.p0.y = 9; 328 296 rect.p1.x = 48; 329 rect.p1.y = 1 1;297 rect.p1.y = 10; 330 298 } else { 331 299 rect.p0.x = 280; 332 rect.p0.y = 1 90;300 rect.p0.y = 155; 333 301 rect.p1.x = 360; 334 rect.p1.y = 215;302 rect.p1.y = 180; 335 303 } 336 304 … … 377 345 { 378 346 smeedit_t *smee; 379 smenu_entry_t *entry;380 startmenu_entry_t *smentry;381 347 const char *cmd; 382 348 const char *caption; 383 bool terminal;384 349 errno_t rc; 385 350 … … 389 354 cmd = ui_entry_get_text(smee->ecmd); 390 355 caption = ui_entry_get_text(smee->ecaption); 391 terminal = ui_checkbox_get_checked(smee->cbterminal);392 356 393 357 if (smee->smentry == NULL) { 394 358 /* Create new entry */ 395 359 rc = smenu_entry_create(smee->startmenu->tbarcfg->tbarcfg, 396 caption, cmd , terminal, &entry);360 caption, cmd); 397 361 if (rc != EOK) 398 362 return; 399 400 rc = startmenu_insert(smee->startmenu, entry, &smentry);401 if (rc != EOK)402 return;403 404 startmenu_repaint(smee->startmenu);405 363 } else { 406 364 /* Edit existing entry */ 365 366 407 367 rc = smenu_entry_set_cmd(smee->smentry->entry, cmd); 408 368 if (rc != EOK) … … 413 373 return; 414 374 415 smenu_entry_set_terminal(smee->smentry->entry, terminal);416 if (rc != EOK)417 return;418 419 375 (void)smenu_entry_save(smee->smentry->entry); 420 376 startmenu_entry_update(smee->smentry);
Note:
See TracChangeset
for help on using the changeset viewer.