Changes in uspace/app/edit/edit.c [46bd63c9:ec50d65e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/edit/edit.c
r46bd63c9 rec50d65e 1 1 /* 2 * Copyright (c) 202 3Jiri Svoboda2 * Copyright (c) 2024 Jiri Svoboda 3 3 * Copyright (c) 2012 Martin Sucha 4 4 * All rights reserved. … … 238 238 239 239 static void edit_wnd_close(ui_window_t *, void *); 240 static void edit_wnd_focus(ui_window_t *, void *, unsigned); 240 241 static void edit_wnd_kbd_event(ui_window_t *, void *, kbd_event_t *); 242 static void edit_wnd_unfocus(ui_window_t *, void *, unsigned); 241 243 242 244 static ui_window_cb_t edit_window_cb = { 243 245 .close = edit_wnd_close, 244 .kbd = edit_wnd_kbd_event 246 .focus = edit_wnd_focus, 247 .kbd = edit_wnd_kbd_event, 248 .unfocus = edit_wnd_unfocus 249 }; 250 251 static void edit_menubar_activate(ui_menu_bar_t *, void *); 252 static void edit_menubar_deactivate(ui_menu_bar_t *, void *); 253 254 static ui_menu_bar_cb_t edit_menubar_cb = { 255 .activate = edit_menubar_activate, 256 .deactivate = edit_menubar_deactivate 245 257 }; 246 258 … … 431 443 } 432 444 445 ui_menu_bar_set_cb(edit->menubar, &edit_menubar_cb, (void *) edit); 446 433 447 rc = ui_menu_dd_create(edit->menubar, "~F~ile", NULL, &mfile); 434 448 if (rc != EOK) { … … 2221 2235 } 2222 2236 2237 /** Window focus event 2238 * 2239 * @param window Window 2240 * @param arg Argument (edit_t *) 2241 * @param focus Focus number 2242 */ 2243 static void edit_wnd_focus(ui_window_t *window, void *arg, unsigned focus) 2244 { 2245 edit_t *edit = (edit_t *)arg; 2246 2247 (void)edit; 2248 pane_caret_display(&pane); 2249 cursor_setvis(true); 2250 } 2251 2223 2252 /** Window keyboard event 2224 2253 * … … 2242 2271 } 2243 2272 2273 /** Window unfocus event 2274 * 2275 * @param window Window 2276 * @param arg Argument (edit_t *) 2277 * @param focus Focus number 2278 */ 2279 static void edit_wnd_unfocus(ui_window_t *window, void *arg, unsigned focus) 2280 { 2281 edit_t *edit = (edit_t *) arg; 2282 2283 (void)edit; 2284 cursor_setvis(false); 2285 } 2286 2287 /** Menu bar activate event 2288 * 2289 * @param mbar Menu bar 2290 * @param arg Argument (edit_t *) 2291 */ 2292 static void edit_menubar_activate(ui_menu_bar_t *mbar, void *arg) 2293 { 2294 edit_t *edit = (edit_t *)arg; 2295 2296 (void)edit; 2297 cursor_setvis(false); 2298 } 2299 2300 /** Menu bar deactivate event 2301 * 2302 * @param mbar Menu bar 2303 * @param arg Argument (edit_t *) 2304 */ 2305 static void edit_menubar_deactivate(ui_menu_bar_t *mbar, void *arg) 2306 { 2307 edit_t *edit = (edit_t *)arg; 2308 2309 (void)edit; 2310 pane_caret_display(&pane); 2311 cursor_setvis(true); 2312 } 2313 2244 2314 /** File / Save menu entry selected. 2245 2315 * … … 2407 2477 { 2408 2478 edit_t *edit = (edit_t *)arg; 2409 gfx_context_t *gc = ui_window_get_gc(edit->window);2410 2479 char *cname; 2411 2480 errno_t rc; 2412 2481 2482 (void)edit; 2413 2483 ui_file_dialog_destroy(dialog); 2414 // TODO Smarter cursor management2415 pane.rflags |= REDRAW_CARET;2416 (void) pane_update(&pane);2417 gfx_cursor_set_visible(gc, true);2418 2484 2419 2485 cname = str_dup(fname); … … 2441 2507 { 2442 2508 edit_t *edit = (edit_t *)arg; 2443 gfx_context_t *gc = ui_window_get_gc(edit->window); 2444 2509 2510 (void)edit; 2445 2511 ui_file_dialog_destroy(dialog); 2446 // TODO Smarter cursor management2447 pane.rflags |= REDRAW_CARET;2448 (void) pane_update(&pane);2449 gfx_cursor_set_visible(gc, true);2450 2512 } 2451 2513 … … 2458 2520 { 2459 2521 edit_t *edit = (edit_t *)arg; 2460 gfx_context_t *gc = ui_window_get_gc(edit->window); 2461 2522 2523 (void)edit; 2462 2524 ui_file_dialog_destroy(dialog); 2463 // TODO Smarter cursor management2464 pane.rflags |= REDRAW_CARET;2465 (void) pane_update(&pane);2466 gfx_cursor_set_visible(gc, true);2467 2525 } 2468 2526 … … 2477 2535 { 2478 2536 edit_t *edit = (edit_t *) arg; 2479 gfx_context_t *gc = ui_window_get_gc(edit->window);2480 2537 char *endptr; 2481 2538 int line; … … 2489 2546 2490 2547 caret_move_absolute(line, pane.ideal_column, dir_before, false); 2491 // TODO Smarter cursor management2548 (void)edit; 2492 2549 (void) pane_update(&pane); 2493 gfx_cursor_set_visible(gc, true);2494 (void) gfx_update(gc);2495 2550 } 2496 2551 … … 2503 2558 { 2504 2559 edit_t *edit = (edit_t *) arg; 2505 gfx_context_t *gc = ui_window_get_gc(edit->window); 2506 2560 2561 (void)edit; 2507 2562 ui_prompt_dialog_destroy(dialog); 2508 // TODO Smarter cursor management2509 pane.rflags |= REDRAW_CARET;2510 (void) pane_update(&pane);2511 gfx_cursor_set_visible(gc, true);2512 2563 } 2513 2564 … … 2520 2571 { 2521 2572 edit_t *edit = (edit_t *) arg; 2522 gfx_context_t *gc = ui_window_get_gc(edit->window); 2523 2573 2574 (void)edit; 2524 2575 ui_prompt_dialog_destroy(dialog); 2525 // TODO Smarter cursor management2526 pane.rflags |= REDRAW_CARET;2527 (void) pane_update(&pane);2528 gfx_cursor_set_visible(gc, true);2529 2576 } 2530 2577 … … 2539 2586 { 2540 2587 edit_t *edit = (edit_t *) arg; 2541 gfx_context_t *gc = ui_window_get_gc(edit->window);2542 2588 char *pattern; 2543 2589 bool reverse; 2544 2590 2591 (void)edit; 2545 2592 ui_prompt_dialog_destroy(dialog); 2546 2593 … … 2559 2606 search(pattern, reverse); 2560 2607 2561 // TODO Smarter cursor management2562 2608 (void) pane_update(&pane); 2563 gfx_cursor_set_visible(gc, true);2564 (void) gfx_update(gc);2565 2609 } 2566 2610 … … 2573 2617 { 2574 2618 edit_t *edit = (edit_t *) arg; 2575 gfx_context_t *gc = ui_window_get_gc(edit->window); 2576 2619 2620 (void)edit; 2577 2621 ui_prompt_dialog_destroy(dialog); 2578 // TODO Smarter cursor management2579 pane.rflags |= REDRAW_CARET;2580 (void) pane_update(&pane);2581 gfx_cursor_set_visible(gc, true);2582 2622 } 2583 2623 … … 2590 2630 { 2591 2631 edit_t *edit = (edit_t *) arg; 2592 gfx_context_t *gc = ui_window_get_gc(edit->window); 2593 2632 2633 (void)edit; 2594 2634 ui_prompt_dialog_destroy(dialog); 2595 // TODO Smarter cursor management2596 pane.rflags |= REDRAW_CARET;2597 (void) pane_update(&pane);2598 gfx_cursor_set_visible(gc, true);2599 2635 } 2600 2636
Note:
See TracChangeset
for help on using the changeset viewer.