Patch level : 10.0
Files correlati : ba0 Ricompilazione Demo : [ ] Commento : 0000901: Prevedere funzione RESET per impostare layout standard git-svn-id: svn://10.65.10.50/trunk@17281 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									86e414892e
								
							
						
					
					
						commit
						0047f23b08
					
				
							
								
								
									
										117
									
								
								ba/ba0103.cpp
									
									
									
									
									
								
							
							
						
						
									
										117
									
								
								ba/ba0103.cpp
									
									
									
									
									
								
							@ -1,5 +1,6 @@
 | 
			
		||||
#include "ba0103.h"
 | 
			
		||||
 | 
			
		||||
#include <config.h>
 | 
			
		||||
#include <defmask.h>
 | 
			
		||||
#include <prefix.h>
 | 
			
		||||
#include <xvtility.h>
 | 
			
		||||
@ -21,6 +22,7 @@ protected:
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  TApp_window(TBook_window* owner);
 | 
			
		||||
  ~TApp_window();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class TBook_window : public TControl_host_window
 | 
			
		||||
@ -30,13 +32,13 @@ class TBook_window : public TControl_host_window
 | 
			
		||||
protected:
 | 
			
		||||
  virtual void update();
 | 
			
		||||
  virtual void handler(WINDOW win, EVENT* ep);
 | 
			
		||||
  short pages() const;
 | 
			
		||||
 | 
			
		||||
  void force_page(short page);
 | 
			
		||||
  void erode_antipa();
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  WINDOW notebook() const { return _ctrl; }
 | 
			
		||||
  short pages() const;
 | 
			
		||||
  WINDOW page_win(short pg);
 | 
			
		||||
  short add_page(const TString& caption);
 | 
			
		||||
  void set_page_caption(short page, const TString& caption, int icon);
 | 
			
		||||
@ -87,6 +89,11 @@ TApp_window::TApp_window(TBook_window* owner) : _owner(owner)
 | 
			
		||||
  xvt_timer_create(w, 1500); // Ogni tanto controllo se l'applicazione e' ancora viva
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TApp_window::~TApp_window() 
 | 
			
		||||
{
 | 
			
		||||
  xvt_sys_close_children(win());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TBook_window
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
@ -154,6 +161,10 @@ void TBook_window::handler(WINDOW win, EVENT* ep)
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
    break;
 | 
			
		||||
  case E_SIZE:
 | 
			
		||||
    if (pages() > 0)
 | 
			
		||||
      dispatch_e_menu(cur_win(), 8883); // Notifica un ridimensionamento indesiderato
 | 
			
		||||
    break;
 | 
			
		||||
  default:
 | 
			
		||||
    break;
 | 
			
		||||
  }
 | 
			
		||||
@ -178,7 +189,8 @@ short TBook_window::add_page(const TString& caption)
 | 
			
		||||
    wd.v.ctl.flags = CTL_FLAG_CENTER_JUST;      // i.e. bottom!
 | 
			
		||||
    xvt_vobj_get_client_rect(win(), &wd.rct);
 | 
			
		||||
    _ctrl = xvt_ctl_create_def(&wd, win(), 0L);
 | 
			
		||||
    xvt_pane_set_size_range(win(), 0, 0);       // Blocca le dimensioni del pannello (Non va!)
 | 
			
		||||
    // Blocca le dimensioni del pannello (Non va!)
 | 
			
		||||
    xvt_pane_set_size_range(win(), wd.rct.right, wd.rct.right, wd.rct.right);       
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  TString256 cap;
 | 
			
		||||
@ -275,6 +287,7 @@ protected:
 | 
			
		||||
public:
 | 
			
		||||
  virtual void create(short dlg, int x, int y, int dx, int dy, WINDOW parent);
 | 
			
		||||
 | 
			
		||||
  short pages() const;
 | 
			
		||||
  short add_page(const TString& caption);
 | 
			
		||||
  void set_page_caption(short page, const TString& caption, int icon);
 | 
			
		||||
  WINDOW page_win(short page);
 | 
			
		||||
@ -282,6 +295,12 @@ public:
 | 
			
		||||
  TBook_field(TMask* m) : TWindowed_field(m) {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
short TBook_field::pages() const
 | 
			
		||||
{
 | 
			
		||||
  TBook_window& bw = (TBook_window&)win();
 | 
			
		||||
  return bw.pages();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
short TBook_field::add_page(const TString& caption)
 | 
			
		||||
{
 | 
			
		||||
  TBook_window& bw = (TBook_window&)win();
 | 
			
		||||
@ -321,9 +340,48 @@ void TBook_field::create(short dlg, int x, int y, int dx, int dy, WINDOW parent)
 | 
			
		||||
// TOutlook_mask
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
void TOutlook_mask::save_perspective(int per)
 | 
			
		||||
{
 | 
			
		||||
  const TTree_field& bf = tfield(DLG_TREE);
 | 
			
		||||
  TString str(_per_def.size());
 | 
			
		||||
  const int sz = xvt_pane_manager_save_perspective(bf.win().win(), NULL, 0); 
 | 
			
		||||
  xvt_pane_manager_save_perspective(bf.win().win(), str.get_buffer(sz), sz); 
 | 
			
		||||
  switch (per)
 | 
			
		||||
  {
 | 
			
		||||
  case  1: 
 | 
			
		||||
    {
 | 
			
		||||
      TConfig ini(CONFIG_GUI, "ba0103");
 | 
			
		||||
      ini.set("Layout", str, NULL, true, bf.dlg());
 | 
			
		||||
    }
 | 
			
		||||
    break;
 | 
			
		||||
  case  2: _per_tmp = str; break;
 | 
			
		||||
  default: _per_def = str; break;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TOutlook_mask::load_perspective(int per)
 | 
			
		||||
{
 | 
			
		||||
  const TTree_field& bf = tfield(DLG_TREE);
 | 
			
		||||
  TString str;
 | 
			
		||||
  switch (per)
 | 
			
		||||
  {
 | 
			
		||||
  case  1:
 | 
			
		||||
    {
 | 
			
		||||
      TConfig ini(CONFIG_GUI, "ba0103");
 | 
			
		||||
      str = ini.get("Layout", NULL, bf.dlg());
 | 
			
		||||
    }
 | 
			
		||||
    break;
 | 
			
		||||
  case  2: str = _per_tmp; break;
 | 
			
		||||
  default: str = _per_def; break;
 | 
			
		||||
  }
 | 
			
		||||
  xvt_pane_manager_load_perspective(bf.win().win(), str); 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
short TOutlook_mask::add_page(const TString& caption)
 | 
			
		||||
{
 | 
			
		||||
  TBook_field& bf = (TBook_field&)field(DLG_MAIN);
 | 
			
		||||
  if (bf.pages() == 0)
 | 
			
		||||
    save_perspective(2);       // Save temporary perspective
 | 
			
		||||
  return bf.add_page(caption);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -333,6 +391,43 @@ void TOutlook_mask::set_page_caption(short page, const TString& caption, int ico
 | 
			
		||||
  bf.set_page_caption(page, caption, icon);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TOutlook_mask::handler(WINDOW w, EVENT* ep)
 | 
			
		||||
{
 | 
			
		||||
  if (ep->type == E_COMMAND)
 | 
			
		||||
  {
 | 
			
		||||
    switch (ep->v.cmd.tag)
 | 
			
		||||
    {
 | 
			
		||||
    case 8001: 
 | 
			
		||||
      {
 | 
			
		||||
        TTree_field& tf = tfield(DLG_TREE);
 | 
			
		||||
        _tree.change_root("MENU_000");  // Torna alla radice standard
 | 
			
		||||
        _tree.goto_root();
 | 
			
		||||
        _tree.shrink_all();
 | 
			
		||||
        tf.win().force_update();        // Provoca la rigenerazione dell'albero collassato
 | 
			
		||||
        tf.on_key(K_SPACE);
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
    case 8002: 
 | 
			
		||||
      load_perspective(0);              // Ricarica default 
 | 
			
		||||
      break;
 | 
			
		||||
    case 8003: 
 | 
			
		||||
      dispatch_e_menu(TASK_WIN, M_FILE_ABOUT);
 | 
			
		||||
      break;
 | 
			
		||||
    case 8883: 
 | 
			
		||||
      if (!_locked && _per_tmp.not_empty())
 | 
			
		||||
      {
 | 
			
		||||
        _locked = true;
 | 
			
		||||
        load_perspective(2); // Ripristina layout predefinito
 | 
			
		||||
        do_events();         // Evita doppio evento E_SIZE
 | 
			
		||||
        _locked = false;
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
    default  : break;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  TSpidey_mask::handler(w, ep);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
			
		||||
{
 | 
			
		||||
  switch (o.dlg())
 | 
			
		||||
@ -410,10 +505,23 @@ bool TOutlook_mask::on_field_event(TOperable_field& o, TField_event e, long joll
 | 
			
		||||
    break;
 | 
			
		||||
  default: break;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (e == fe_info)
 | 
			
		||||
  {
 | 
			
		||||
    MENU_ITEM* mi = xvt_res_get_menu(10004); // Menu_Ba0-3
 | 
			
		||||
    if (mi != NULL)
 | 
			
		||||
    {
 | 
			
		||||
      const PNT pos = { -1, -1 };
 | 
			
		||||
      xvt_menu_popup(mi->child, o.parent(), pos, XVT_POPUP_LEFT_ALIGN, 0);
 | 
			
		||||
      xvt_res_free_menu_tree(mi);
 | 
			
		||||
      return false; // Non fare la gestione standard
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TOutlook_mask::TOutlook_mask(TMenu& menu) : _tree(menu)
 | 
			
		||||
TOutlook_mask::TOutlook_mask(TMenu& menu) : _tree(menu), _locked(false)
 | 
			
		||||
{ 
 | 
			
		||||
  xvtil_statbar_destroy(); // Ammazza status bar inutile
 | 
			
		||||
  RCT rct; xvt_vobj_get_client_rect(TASK_WIN, &rct);
 | 
			
		||||
@ -453,11 +561,14 @@ TOutlook_mask::TOutlook_mask(TMenu& menu) : _tree(menu)
 | 
			
		||||
  xvt_pane_add(panel, dlg2win(DLG_TREE), "Menu", 1, 0); // Left upper pane
 | 
			
		||||
  xvt_pane_add(panel, dlg2win(DLG_LOOK), "Bar",  1, 0); // Left lower pane
 | 
			
		||||
  xvt_pane_add(panel, dlg2win(DLG_MAIN), "Main", 0, 0); // Main pane
 | 
			
		||||
  save_perspective(0); // Salva default
 | 
			
		||||
  load_perspective(1); // Carica custom
 | 
			
		||||
  set_handlers();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TOutlook_mask::~TOutlook_mask()
 | 
			
		||||
{
 | 
			
		||||
  save_perspective(1); // Salva custom
 | 
			
		||||
  // Ricostruisci status bar tornata utile
 | 
			
		||||
  xvtil_create_statbar();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -18,11 +18,18 @@ class TOutlook_mask : public TSpidey_mask
 | 
			
		||||
  TMenu_tree _tree;
 | 
			
		||||
  int _icon[16];
 | 
			
		||||
 | 
			
		||||
  TString _per_def, _per_tmp;
 | 
			
		||||
  bool _locked;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  virtual void handler(WINDOW w, EVENT* ep);
 | 
			
		||||
  virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | 
			
		||||
  short add_page(const TString& caption);
 | 
			
		||||
  void set_page_caption(short page, const TString& caption, int icon);
 | 
			
		||||
 | 
			
		||||
  void save_perspective(int per);
 | 
			
		||||
  void load_perspective(int per);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  TOutlook_mask(TMenu& menu);
 | 
			
		||||
  ~TOutlook_mask();
 | 
			
		||||
 | 
			
		||||
@ -1305,7 +1305,7 @@ void TReport_window::handler(WINDOW win, EVENT* ep)
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
    owner().mask().notify_focus_field(owner().dlg());
 | 
			
		||||
    break;
 | 
			
		||||
    return; // Termina qui la gestione del bottone
 | 
			
		||||
  case E_MOUSE_MOVE:
 | 
			
		||||
    {
 | 
			
		||||
      TMask& m = owner().mask();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user