Пример #1
0
void ConfigDialog::AddControls()
{
	Container* parent = new Container( this );
	parent->setLayout( new GridBagLayout() );

	Container* fieldsPanel = new Container();
	fieldsPanel->setLayout( new GridBagLayout() );

	GridBagConstraints c; 
	c.gridwidth = 1;  c.insets = Insets( 5,5, 5,5 );
	c.fill = GridBagConstraints::HORIZONTAL;
	int rmd = GridBagConstraints::REMAINDER;
	int y = 0;

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1,"hgap:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpHgap ),  &c ); c.gridwidth = 1;  

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "vgap:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpVgap ),  &c ); c.gridwidth = 1;  

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "inset.left:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpLeft ),        &c ); c.gridwidth = 1;        

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "insets.right:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpRight ),         &c ); c.gridwidth = 1;         

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "insets.top:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpTop ),         &c ); c.gridwidth = 1;         

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "insets.bottom:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpBottom ),         &c  ); c.gridwidth = 1;         

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "Grid-rows:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpRowCount ),   &c  ); c.gridwidth = 1;   

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "Grid-cols:" ), &c ); c.gridwidth = rmd;
	fieldsPanel->add( MakeField( mpColCount ),   &c  ); c.gridwidth = 1;   

	c.gridy = y++; 
	fieldsPanel->add( new wxStaticText( this,-1, "Panel-font:" ), &c ); c.gridwidth = 1;   c.weightx = 1.0;
	fieldsPanel->add( MakeField( mpFont ),        &c ); c.gridwidth = rmd; c.weightx = 0.0;

	fieldsPanel->add( MakeButton( "Select &font...", ID_SELECT_FONT ), &c  ); c.gridwidth = 1;

	Container* checkPanel1 = new Container();
	Container* checkPanel2 = new Container();
	Container* checkPanel3 = new Container();
	Container* btnPanel    = new Container();

	c.weightx = 1.0;

	c.gridx = 0; c.gridy = y++; 
	parent->add( fieldsPanel, &c ); c.gridwidth = rmd;

	c.insets.left = 10;	c.gridx = 0; 
	
	c.gridy = y++; parent->add( checkPanel1, &c ); c.gridwidth = rmd;

	c.gridy = y++; parent->add( checkPanel2, &c );

	c.gridy = y++; parent->add( checkPanel3, &c );

	c.gridy = y++; parent->add( new wxStaticText( this,-1, 
								"(Note: this dialog is also resizable)" ), &c );

	c.gridy = y++; 
	parent->add( btnPanel, &c );

	checkPanel1->setLayout( new BoxLayout( BoxLayout::X_AXIS ) );
	checkPanel2->setLayout( new BoxLayout( BoxLayout::X_AXIS ) );
	checkPanel3->setLayout( new BoxLayout( BoxLayout::X_AXIS ) );

	c.insets.left = 10;
	checkPanel1->add( MakeCheckBox( "Use light-wieght comp. ",   mpUseLightWeight ) );
	checkPanel1->add( MakeCheckBox( "Use double-buffering.",    mpUseDoubleBuf ) );
	checkPanel2->add( MakeCheckBox( "Show source for layout.",  mpShowSrcCode ) );
	checkPanel2->add( MakeCheckBox( "Auto-pack layout.",        mpAutoPack ) );
	checkPanel3->add( MakeCheckBox( "Enable \"2-Phase layouting\" feature.", mpUseTwoPhase ) );

	btnPanel->setLayout( new FlowLayout() );

	btnPanel->add( MakeButton( "&Apply", wxID_APPLY ) );
	btnPanel->add( MakeButton( "Apply && &return", ID_APPLY_AND_EXIT ) );
	btnPanel->add( MakeButton( "&Cancel", wxID_CANCEL ) );
	btnPanel->add( MakeButton( "&View dlg-source", ID_SHOW_DLG_SOURCE ) );

	mpFont->Enable( FALSE ); 
									 
	if ( !_gCfgDlgSizeAdjusted ) 
	{
		// for packing dialog initially use only 1-phase layouting
		// to let buttons in FlowLayout'ed btnPanel strech within\ in a single row

		parent->setTwoPhaseLayoutingGlobally(FALSE);

		parent->pack();

		// for the other resizing do it the "featured" way

		parent->setTwoPhaseLayoutingGlobally(TRUE);
	}
}
Пример #2
0
ComparisonTableView::ComparisonTableView()
	: wxFrame(NULL, wxID_ANY, "Ferret: Table of comparisons", 
		wxDefaultPosition, wxSize (650, 610))
{
	CentreOnScreen ();
	CreateStatusBar(4);
  int widths [] = {-2, -1, -1, -1};
	SetStatusWidths (4, widths);
	SetStatusText("Welcome to Ferret", 0);
	SetStatusText("Documents: ", 1);
	SetStatusText("Pairs: ", 2);
  SetStatusText("Mean: ", 3);
	
	// set up internal widgets
	wxBoxSizer * topsizer = new wxBoxSizer (wxHORIZONTAL);
	
	// 1. comparison table
	wxPanel * docResemblanceView = new wxPanel (this, wxID_ANY);
	wxBoxSizer * resemblanceSizer = new wxBoxSizer (wxVERTICAL);
	docResemblanceView->SetSizer (resemblanceSizer);

	_resemblanceObserver = new DocumentListCtrl (this, docResemblanceView);
	resemblanceSizer->Add (_resemblanceObserver, 1, wxGROW);

	// -- insert three columns
	wxListItem itemCol;
	itemCol.SetText ("Document 1");
	_resemblanceObserver->InsertColumn (0, itemCol);
	_resemblanceObserver->SetColumnWidth (0, wxLIST_AUTOSIZE_USEHEADER);
	itemCol.SetText ("Document 2");
	_resemblanceObserver->InsertColumn (1, itemCol);
	_resemblanceObserver->SetColumnWidth (1, wxLIST_AUTOSIZE_USEHEADER);
	itemCol.SetText ("Similarity");
	_resemblanceObserver->InsertColumn (2, itemCol);
	_resemblanceObserver->SetColumnWidth (2, wxLIST_AUTOSIZE_USEHEADER);

	// 2. buttons 
	// -- note, buttons must be defined before their staticboxsizer, 
	// else tooltips do not display
	wxBoxSizer  * buttonSizer = new wxBoxSizer (wxVERTICAL);
  buttonSizer->Add (MakeButton (this, ID_SAVE_REPORT, "Save Report ...",
        "Save the table of comparisons and other details"),
      0, wxGROW | wxALL, 5);
  buttonSizer->Add (MakeButton (this, ID_UNIQUE_VIEW, "Show Uniqueness", 
        "Show number of unique trigrams per document or group"),
      0, wxGROW | wxALL, 5);
  buttonSizer->Add (MakeButton (this, ID_ENGAGEMENT_VIEW, "Show Engagement", 
        "Show overlap with template material per document or group"),
      0, wxGROW | wxALL, 5);

	wxButton * rank_1 = MakeButton (this, ID_RANK_1, "Document 1",
				"Put table into alphabetical order of first document");
	wxButton * rank_2 = MakeButton (this, ID_RANK_2, "Document 2",
				"Put table into alphabetical order of second document");
	wxButton * rank_r = MakeButton (this, ID_RANK_R, "Similarity",
				"Put table into order with most similar at top");
	wxStaticBoxSizer * rankSizer = new wxStaticBoxSizer (wxVERTICAL, this, "Rearrange table by");
	rankSizer->Add (rank_1, 0, wxGROW | wxALL, 5);
	rankSizer->Add (rank_2, 0, wxGROW | wxALL, 5);
	rankSizer->Add (rank_r, 0, wxGROW | wxALL, 5);
	buttonSizer->Add (rankSizer, 0, wxGROW);

	wxButton * showButton = MakeButton (this, ID_DISPLAY_TEXTS, "Show Analysis",
				"Show selected documents in a separate window");
	wxButton * saveButton = MakeButton (this, ID_CREATE_REPORT, "Save Analysis ...",
				"Save analysis of the selected documents");
	wxStaticBoxSizer * showSizer = new wxStaticBoxSizer (wxVERTICAL, this, "For selected pair");
	showSizer->Add (showButton, 0, wxGROW | wxALL, 5);
	showSizer->Add (saveButton, 0, wxGROW | wxALL, 5);
	buttonSizer->Add (showSizer, 0, wxGROW);

	buttonSizer->AddStretchSpacer (); // separate controls

  buttonSizer->Add (MakeCheckBox (this, ID_REMOVE_COMMON, "Remove Common Trigrams",
      "Compute similarity only from trigrams for the two documents", false), 
      0, wxGROW | wxALL, 5);  
  buttonSizer->Add (MakeCheckBox (this, ID_IGNORE_TEMPLATE, "Ignore Template Material",
      "Compute similarity but ignore any trigrams in template material", false), 
      0, wxGROW | wxALL, 5);  
  buttonSizer->Add (MakeCheckBox (this, ID_SHOW_SHORT, "Show Short Names",
      "Uncheck to show full pathnames in table", true), 
      0, wxGROW | wxALL, 5);

	buttonSizer->AddStretchSpacer (); // separate window controls from Ferret controls
	buttonSizer->Add (new wxButton (this, wxID_HELP), 0, wxGROW | wxALL, 5);
	buttonSizer->Add (new wxButton (this, wxID_EXIT), 0, wxGROW | wxALL, 5);
	
	topsizer->Add (buttonSizer, 0, wxGROW | wxALL, 5);
	topsizer->Insert (0, docResemblanceView, 1, wxGROW);
	
	// compute best minimum height, and constrain window
	int best_height = buttonSizer->GetMinSize().GetHeight () + 40; // allow for space between widgets
	SetSizeHints (best_height, best_height); // keep the minimum size a square shape

	SetSizer (topsizer);
	_resemblanceObserver->SetFocus ();  // give focus to the list control, to show highlighted item

#if __WXMSW__
	SetBackgroundColour (wxNullColour); // ensure background coloured
#endif
}
Пример #3
0
void MyFrame::Test_All_1( wxCommandEvent& event )
{
	RemoveAll(); SetTestName( "Test_All_1" );

	parent = new Container( this );
	SetCurrentContainer( parent );

	parent->setLayout( new GridBagLayout() );

	GridBagConstraints c;
	c.weightx   = 1.0;
	c.weighty   = 1.0;
	c.fill      = GridBagConstraints::BOTH;
	c.gridwidth = GridBagConstraints::REMAINDER;

	Container* sortPanel = MakeStaticBox( "Filtering options: (in GridBagLayout)" );

	Container* btnPanel = new Container();

	parent->add( sortPanel, &c );

	c.weighty   = 0.0;
	parent->add( btnPanel,  &c );

	btnPanel->setLayout( new FlowLayout() );
	btnPanel->setInsets( Insets( 10,10, 10,10 ) );

	btnPanel->add( MakeLabel( "Buttons:" ) );
	btnPanel->add( MakeButton( "&Apply" ) );
	btnPanel->add( MakeButton( "&Cancel" ) );
	btnPanel->add( MakeButton( "&Help" ) );
	btnPanel->add( MakeLabel( "in a FlowLayout" ) );

	SetCurrentContainer( sortPanel );

	sortPanel->setInsets( GetInsetsForStaticBox( sortPanel ) );

	// creating "Resolution" panel

	sortPanel->setLayout( new GridBagLayout() );

	char* resValues[] = { "FIXED", "INVALID", "WONTFIX", "LATER", "REMIND", 
					      	"DUPLICATE", "WORKSFORME" };
	char* pltfValues[] = { "All", "DEC", "HP", "Macintosh", "PC", "SGI", "Sun", "Other" };

	char* opSysValues[] = { "All", "Windows 3.1", "Windows 95", "Windows 98", "Windows NT", 
						    "Mac Sys7", "Mac Sys7.5", "Mac Sys7.6.1", "Mac Sys8.0",
						    "Mac Sys7", "Mac Sys8.5", "Mac Sys8.6",
						    "Aix", "BSD", "IRIX", "Linux", "FreeBSD", "NetBSD", "OSF/1", "SOLARIS",
						    "SunOS", "Neutrino", "OS/2", "OpenVMS", "other" };

	char* compValues[] = { "Not applied", "wxGrid", "wxHTML", "wxMedia",
						   "wxLayout", "wxDialupManager", "wxFrameLayout" };

	char* severValues[] = { "Blocker", "Critical", "Major", "Minor",
						    "Trivial", "Enhancement", "Showstopper" };

	char* priValues[]   = { "P1", "P2", "P3", "P4", "P5" };

	int resCnt   = sizeof( resValues )   / sizeof(char*);
	int pltfCnt  = sizeof( pltfValues )  / sizeof(char*);
	int opSysCnt = sizeof( opSysValues ) / sizeof(char*);
	int compCnt  = sizeof( compValues  ) / sizeof(char*);
	int svrCnt   = sizeof( severValues ) / sizeof(char*);
	int priCnt   = sizeof( priValues   ) / sizeof(char*);

	c.weightx   = 1.0;
	c.fill      = GridBagConstraints::BOTH;

	c = GridBagConstraints(); // reset defauls
	c.fill      = GridBagConstraints::BOTH;
	int rel = GridBagConstraints::RELATIVE;
	c.weightx = 1.0;
	c.insets.left = 2; c.insets.right = 2;

	c.gridx = 1; c.gridy = 1;
	sortPanel->add( MakeListBox ( resValues, resCnt ),   &c ); c.gridx = 2; c.gridwidth = 2;
	sortPanel->add( MakeListBox ( severValues, svrCnt ), &c ); c.gridx = 4; c.gridwidth = 1;
	sortPanel->add( MakeListBox ( priValues, priCnt ),   &c );

	c.gridy = 3; c.gridx = 1; c.weighty = 1.0; c.gridwidth = 2;
	sortPanel->add( MakeListBox ( compValues, compCnt ), &c ); c.gridx = 3;
	sortPanel->add( MakeListBox ( pltfValues, pltfCnt ), &c ); c.gridwidth = 1;

	c.gridx = 0; c.gridy = 1; c.weighty = 1.0; c.gridheight = GridBagConstraints::REMAINDER;
	sortPanel->add( MakeListBox ( opSysValues, opSysCnt ), &c );

	c.gridx = 0; c.gridy = 0; c.gridheight = 1; c.weighty = 0.0;
	sortPanel->add( MakeCheckBox( "OpSys" ),      &c ); c.gridx = 1;
	sortPanel->add( MakeCheckBox( "Resolution" ), &c ); c.gridx = 2; c.gridwidth = 2;
	sortPanel->add( MakeCheckBox( "Severity" ),   &c ); c.gridx = 4; c.gridwidth = 0;
	sortPanel->add( MakeCheckBox( "Priority" ),   &c );

	c.gridx = 1; c.gridy = 2; c.gridwidth = 2;
	sortPanel->add( MakeCheckBox( "Component" ), &c ); c.gridx = 3;
	sortPanel->add( MakeCheckBox( "Platform" ),  &c ); c.gridwidth = 0;

	Container* keywordsPanel = MakeStaticBox( "Contain Keywords: (in another grid-bag)" );
	keywordsPanel->setInsets( GetInsetsForStaticBox( keywordsPanel ) );

	c.gridx = 1; c.gridy = 4; c.insets.top = 5;
	c.gridwidth = GridBagConstraints::REMAINDER; c.weighty = 0.0;
	sortPanel->add( keywordsPanel, &c );

	keywordsPanel->setLayout( new GridBagLayout() );

	SetCurrentContainer( keywordsPanel );

	c = GridBagConstraints(); // reset defauls
	c.anchor = GridBagConstraints::NORTHWEST;

	c.gridx = 0; c.gridy = 0;
	keywordsPanel->add( MakeRadioButton( "Up", TRUE ), &c );
	
	c.gridx = 0; c.gridy = 1;
	keywordsPanel->add( MakeRadioButton( "Down" ), &c );

	c.gridx = 0; c.gridy = 2;
	keywordsPanel->add( MakeRadioButton( "Start" ), &c );

	c.fill   = GridBagConstraints::BOTH;
	c.gridx = 1; c.gridy = 0; c.weightx = 1.0; c.weighty = 1.0; c.gridheight = 3; 
	keywordsPanel->add( MakeTextField( "p1, fixed, bcc" ), &c );

	if ( mCfg.mAutoPack ) parent->pack();
				     else parent->doLayout();
}