diff options
author | Bastian Wissler | 2008-10-14 20:26:38 +0200 |
---|---|---|
committer | Bastian Wissler | 2008-10-14 20:26:38 +0200 |
commit | 6f576f8ba090cfa4e003c3995940a73fe182ec7a (patch) | |
tree | 3078837370011e794beb754fadc015a30fe07fc8 | |
parent | openslx-src-tools/vmchooser: * removed group argument / * added version flag ... (diff) | |
download | vmchooser-6f576f8ba090cfa4e003c3995940a73fe182ec7a.tar.gz vmchooser-6f576f8ba090cfa4e003c3995940a73fe182ec7a.tar.xz vmchooser-6f576f8ba090cfa4e003c3995940a73fe182ec7a.zip |
source of vmchooser updated to fix a bug when starting an image
git-svn-id: http://svn.openslx.org/svn/openslx/openslx-src-tools/vmchooser/trunk@2297 95ad53e4-c205-0410-b2fa-d234c58c8868
-rw-r--r-- | vmchooser/SWindow.cxx | 32 | ||||
-rw-r--r-- | vmchooser/inc/SWindow.h | 1 | ||||
-rw-r--r-- | vmchooser/main.cxx | 7 |
3 files changed, 26 insertions, 14 deletions
diff --git a/vmchooser/SWindow.cxx b/vmchooser/SWindow.cxx index 40b0402..1763ddb 100644 --- a/vmchooser/SWindow.cxx +++ b/vmchooser/SWindow.cxx @@ -70,10 +70,15 @@ SWindow::SWindow(int w, int h, char* p): *********************************************************/ void SWindow::cb_return() { - curr = (Item*) sel.item(); + //if(!sel.item()) return; + //curr = (Item*) sel.item(); + if(curr != 0 && curr->user_data()) { DataEntry* dat = (DataEntry*) curr->user_data(); - runImage(curr, dat); + cout << dat->short_description << endl; + if(dat) { + runImage(curr, dat); + } } } @@ -81,28 +86,30 @@ void SWindow::cb_return() /******************************************************* * Callback for Selection-Browser in the center * ---------------------------------------------------- - * Changes info-Text at the bottom + * Starts the session if required -> Mouse Click *******************************************************/ void SWindow::cb_select() { + if(!sel.item()) return; + //cout << "cb_select called with" << sel.item() << endl; sel.select_only_this(); if (sel.item_is_parent() ) { sel.set_item_opened(true); + return; } - if( curr == sel.item() && curr != NULL ) { - //Doubleclick + oldcurr = curr; + curr = (Item*) sel.item(); + + if( curr == oldcurr ) { + // start image if it has data associated + // -> double click cout << ((DataEntry*)curr->user_data())->short_description << endl; if(curr->user_data()) { runImage(curr, (DataEntry*) curr->user_data() ); } return; } - curr = (Item*) sel.item(); -// if(curr->user_data()) { -// DataEntry* dat = (DataEntry*) curr->user_data(); -// info.text(dat->description.c_str()); -// } } @@ -182,7 +189,10 @@ void SWindow::unfold_entries() { sel.set_item_opened(true); } sel.next_visible(); - sel.select_only_this(); + sel.select_only_this(1); + curr = (Item*) sel.item(); + //sel.set_focus(); + //sel.set_item_selected(true,1); } diff --git a/vmchooser/inc/SWindow.h b/vmchooser/inc/SWindow.h index 321c228..0f8a854 100644 --- a/vmchooser/inc/SWindow.h +++ b/vmchooser/inc/SWindow.h @@ -34,6 +34,7 @@ private: // currently selected Browser-Item fltk::Item* curr; + fltk::Item* oldcurr; // Two groups - Linux and VMWare fltk::ItemGroup* entgroup; diff --git a/vmchooser/main.cxx b/vmchooser/main.cxx index 23fde59..7f15792 100644 --- a/vmchooser/main.cxx +++ b/vmchooser/main.cxx @@ -42,9 +42,9 @@ int main(int argc, char** argv) { opt->addUsage(""); opt->setFlag("help",'h'); + opt->setFlag("version",'v'); opt->setOption("path", 'p'); opt->setOption("lpath", 'l'); - opt->setFlag("version",'v'); opt->setOption("size",'s'); opt->processCommandArgs(argc, argv); @@ -109,8 +109,9 @@ int main(int argc, char** argv) { } delete opt; - - cout << "virtual machine chooser 0.0.1"<< endl; + + // just print out version information - helps testing + cout << "virtual machine chooser 0.0.2"<< endl; if(version) { exit(1); } |