From 84da85924c026b9a36dfb48b9b4a0e1e36c74c69 Mon Sep 17 00:00:00 2001 From: slava Date: Thu, 30 Nov 2006 07:55:55 +0000 Subject: [PATCH] Split up ui.factor, and other cleanups --- TODO.txt | 9 +- core/ui/commands.factor | 13 +++ core/ui/{tools => }/debugger.factor | 19 ++- core/ui/gadgets/labelled-gadget.factor | 44 +++++++ core/ui/gadgets/presentations.factor | 5 + core/ui/load.factor | 4 +- core/ui/tools/workspace.factor | 9 +- core/ui/ui.factor | 155 +------------------------ core/ui/windows.factor | 87 ++++++++++++++ 9 files changed, 180 insertions(+), 165 deletions(-) rename core/ui/{tools => }/debugger.factor (69%) create mode 100644 core/ui/gadgets/labelled-gadget.factor create mode 100644 core/ui/windows.factor diff --git a/TODO.txt b/TODO.txt index ad1df4b360..36710fe818 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,9 +1,9 @@ + 0.87: -- parse errors should be shown in a popup - - menu Command: quots look dumb - - no need for modify-listener-operation! - - command buttons: indicate shortcuts +- menu Command: quots look dumb +- no need for modify-listener-operation! +- command buttons: indicate shortcuts +- hide popup after a restart - http://paste.lisp.org/display/30426 - update ui docs @@ -49,6 +49,7 @@ + ui: +- copying pane output - how do we refer to command shortcuts in the docs? - editor: - autoscroll diff --git a/core/ui/commands.factor b/core/ui/commands.factor index 033eb5e873..cc5f9a5296 100644 --- a/core/ui/commands.factor +++ b/core/ui/commands.factor @@ -99,3 +99,16 @@ SYMBOL: operations : modify-commands ( operations quot -- operations ) swap [ modify-command ] map-with ; + +: command-description ( command -- element ) + dup command-name swap command-gesture gesture>string + 2array ; + +: commands. ( commands -- ) + [ command-gesture key-down? ] subset + [ command-description ] map + { { $strong "Command" } { $strong "Shortcut" } } add* + $table ; + +: $commands ( elt -- ) + first2 swap commands hash commands. ; diff --git a/core/ui/tools/debugger.factor b/core/ui/debugger.factor similarity index 69% rename from core/ui/tools/debugger.factor rename to core/ui/debugger.factor index fbaff81f2d..efd8b9899e 100644 --- a/core/ui/tools/debugger.factor +++ b/core/ui/debugger.factor @@ -1,9 +1,14 @@ ! Copyright (C) 2006 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -IN: gadgets-debugger -USING: errors sequences gadgets gadgets-buttons gadgets-listener -gadgets-panes gadgets-lists gadgets-scrolling gadgets-theme -kernel models arrays namespaces ; +IN: gadgets-listener +DEFER: call-listener + +IN: gadgets +USING: arrays errors gadgets gadgets-buttons +gadgets-labels gadgets-panes gadgets-presentations +gadgets-scrolling gadgets-theme gadgets-viewports gadgets-lists +generic hashtables io kernel math models namespaces prettyprint +queues sequences test threads help sequences words timers ; : [ call-listener drop ] curry ; @@ -44,3 +49,9 @@ debugger "toolbar" { } [ first3 [ call-listener drop ] curry 3array ] map define-commands + +: debugger-window ( error restarts -- ) + restarts get "Error" open-titled-window ; + +: ui-try ( quot -- ) + [ debugger-window ] recover ; diff --git a/core/ui/gadgets/labelled-gadget.factor b/core/ui/gadgets/labelled-gadget.factor new file mode 100644 index 0000000000..7219cafde8 --- /dev/null +++ b/core/ui/gadgets/labelled-gadget.factor @@ -0,0 +1,44 @@ +IN: gadgets +USING: arrays errors gadgets gadgets-buttons +gadgets-labels gadgets-theme gadgets-panes gadgets-scrolling +generic hashtables io kernel math models namespaces prettyprint +queues sequences test threads help sequences words timers ; + +TUPLE: labelled-gadget content ; + +C: labelled-gadget ( gadget title -- gadget ) + { + { [