From 44e31bd1156b0096457a76e5dbcbc7852e25eb78 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Sun, 30 Aug 2015 13:11:49 +0200 Subject: [PATCH] readme update --- README.md | 4 +-- doc/readme.txt | 12 ++++---- src/fmenu.cpp | 71 +++++++++++++++++++++++++++++++++++++++-------- src/fmenulist.cpp | 6 ---- src/fmenulist.h | 2 +- stamp-h1 | 1 + 6 files changed, 70 insertions(+), 26 deletions(-) create mode 100644 stamp-h1 diff --git a/README.md b/README.md index ccdd0f53..cfce6aa2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ The Final Cut [![Build Status](https://travis-ci.org/gansm/finalcut.svg?branch=master)](https://travis-ci.org/gansm/finalcut) ============= -The Final Cut is a programming library and widget toolkit that creates a text-based user interface with full mouse support. It supports the controlled handling of multiple simultaneous windows. -The C++ class design is inspired by the Qt framework. It offers common user interface elements like dialog windows, push buttons, check boxes, radio buttons, input lines, list boxes, status bars and so on. +The Final Cut is a class library and widget toolkit with full mouse support for creating a text-based user interface. The library supports the programmer to develop an application for the text console. It allows the simultaneous handling of multiple windows on the screen. +The C++ class design was inspired by the Qt framework. It provides common controls like dialog windows, push buttons, check boxes, radio buttons, input lines, list boxes, status bars and so on. ![](https://github.com/gansm/finalcut/blob/master/doc/fileopen-dialog.png) diff --git a/doc/readme.txt b/doc/readme.txt index 140b0b72..066405be 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -2,10 +2,12 @@ The Final Cut ---------------------------------------------------------------------- -The Final Cut is a programming library and widget toolkit that creates -a text-based user interface with full mouse support. It supports the -controlled handling of multiple simultaneous windows. -The C++ class design is inspired by the Qt framework. It offers common -user interface elements like dialog windows, push buttons, check boxes, +The Final Cut is a class library and widget toolkit with full mouse +support for creating a text-based user interface. The library supports +the programmer to develop an application for the text console. It allows +the simultaneous handling of multiple windows on the screen. + +The C++ class design was inspired by the Qt framework. It provides +common controls like dialog windows, push buttons, check boxes, radio buttons, input lines, list boxes, status bars and so on. diff --git a/src/fmenu.cpp b/src/fmenu.cpp index 4cf34cff..ae7275db 100644 --- a/src/fmenu.cpp +++ b/src/fmenu.cpp @@ -39,6 +39,21 @@ FMenu::FMenu (const char* txt, FWidget* parent) : FWindow(parent) //---------------------------------------------------------------------- FMenu::~FMenu() { + activatePrevWindow(); + delWindow(this); + + const FRect& geometry = getGeometryGlobalShadow(); + restoreVTerm (geometry); + parentWidget()->redraw(); // ???? + + if ( vwin != 0 ) + { + if ( vwin->changes != 0 ) + delete[] vwin->changes; + if ( vwin->text != 0 ) + delete[] vwin->text; + delete vwin; + } } @@ -46,8 +61,35 @@ FMenu::~FMenu() //---------------------------------------------------------------------- void FMenu::init() { + width = 10; + height = 2; + xmin = 1; + ymin = 1; + xmax = width; + ymax = height; + client_xmin = 1; + client_ymin = 1; + client_xmax = width; + client_ymax = height; + top_padding = 1; + left_padding = 1; + bottom_padding = 1; + right_padding = 1; + createArea (vwin); + setGeometry (1, 1, 10, 2, false); // initialize geometry values + ignore_padding = true; + window_object = true; + addWindow(this); + setActiveWindow(this); + + FWidget* old_focus = FWidget::getFocusWidget(); + if ( old_focus ) + { + setFocus(); + old_focus->redraw(); + } + item->setMenu(this); - setGeometry (1,1,1,1); } //---------------------------------------------------------------------- @@ -93,7 +135,18 @@ int FMenu::getHotkeyPos (wchar_t*& src, wchar_t*& dest, uInt length) //---------------------------------------------------------------------- void FMenu::draw() { + if ( itemlist.empty() ) + return; + + // fill the background + setColor (foregroundColor, backgroundColor); + setUpdateVTerm(false); + clrscr(); + drawBorder(); + drawItems(); + + setUpdateVTerm(true); } //---------------------------------------------------------------------- @@ -102,11 +155,6 @@ void FMenu::drawItems() std::vector::const_iterator iter, end; int y = 1; - if ( itemlist.empty() ) - return; - - setUpdateVTerm(false); - iter = itemlist.begin(); end = itemlist.end(); @@ -144,7 +192,7 @@ void FMenu::drawItems() } gotoxy (xpos+xmin+1, ypos+ymin+y); setColor (foregroundColor, backgroundColor); - print (vmenubar, ' '); + print (' '); txt = (*iter)->getText(); txt_length = int(txt.getLength()); @@ -169,13 +217,13 @@ void FMenu::drawItems() setColor (wc.menu_hotkey_fg, wc.menu_hotkey_bg); if ( ! isNoUnderline ) setUnderline(); - print (vmenubar, item_text[z]); + print (item_text[z]); if ( ! isNoUnderline ) unsetUnderline(); setColor (foregroundColor, backgroundColor); } else - print (vmenubar, item_text[z]); + print (item_text[z]); } if ( isActive && isSelected ) @@ -185,7 +233,6 @@ void FMenu::drawItems() ++iter; y++; } - setUpdateVTerm(true); } //---------------------------------------------------------------------- @@ -350,8 +397,8 @@ void FMenu::setGeometry (int xx, int yy, int ww, int hh, bool adjust) int old_width = width; int old_height = height; FWidget::setGeometry (xx, yy, ww, hh, adjust); - if ( vmenubar && (width != old_width || height != old_height) ) - resizeArea (vmenubar); + if ( vwin && (width != old_width || height != old_height) ) + resizeArea (vwin); } //---------------------------------------------------------------------- diff --git a/src/fmenulist.cpp b/src/fmenulist.cpp index 82807f63..eaaefcc4 100644 --- a/src/fmenulist.cpp +++ b/src/fmenulist.cpp @@ -102,9 +102,3 @@ void FMenuList::clear() itemlist.clear(); } - -// protected methods of FMenuList -//---------------------------------------------------------------------- -/*void FMenuList::cb_item_activated (FWidget*, void*) -{ -}*/ diff --git a/src/fmenulist.h b/src/fmenulist.h index 3104f4f3..526c5229 100644 --- a/src/fmenulist.h +++ b/src/fmenulist.h @@ -15,7 +15,7 @@ │ FMenuList ├-------┤ FMenuItem │ └───────────┘◄───┐ └───┬───────┘ ┌─────────┐ │ ┌───┴───┐ - │ FWidget │◄───┴──┤ FMenu │ + │ FWindow │◄───┴──┤ FMenu │ └─────────┘ └───────┘ */ diff --git a/stamp-h1 b/stamp-h1 new file mode 100644 index 00000000..4547fe1b --- /dev/null +++ b/stamp-h1 @@ -0,0 +1 @@ +timestamp for config.h