|
/*
SqlBuilder - an intelligent database tool
This file is part of SqlBuilder.
www.netcult.ch/elmue
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You find the GNU General Public License in the subfolder GNU
if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using SqlBuilder.Controls;
namespace SqlBuilder.Forms
{
/// <summary>
/// Summary description for frmSearchResult.
/// </summary>
public class frmSearchResult : frmBaseForm
{
Hashtable mi_Result;
string ms_Text;
public frmSearchResult(Hashtable i_SearchResult, string s_SearchText)
{
mi_Result = i_SearchResult;
ms_Text = s_SearchText;
InitializeComponent();
StoreWindowPos = true; // must be set in Constructor AFTER InitializeComponent() !!
ArrayList i_SysObjs = new ArrayList(i_SearchResult.Keys);
i_SysObjs.Sort();
bool b_Select = true;
foreach (string s_SysObj in i_SysObjs)
{
listFiles.AddItem(s_SysObj, b_Select);
b_Select = false;
}
rtfBox.ReadOnly = true;
rtfBox.LabelStatus = lblStatus;
}
private void OnListFilesSelectedIndexChanged(object sender, EventArgs e)
{
// This eventhandler is called TWICE on click !!!
ListViewEx.kItem k_Item = listFiles.SelectedItem;
if (!k_Item.b_Valid)
return; // invalid data
Parser i_Parser = new Parser();
i_Parser.Parse((string)mi_Result[k_Item.s_RelPath], true, true);
rtfBox.Rtf = i_Parser.GetRtf(rtfBox.Font);
rtfBox.SearchAndSelectText(ms_Text);
}
private void OnListFilesMouseUp(object sender, MouseEventArgs e)
{
rtfBox.Focus();
}
private void OnButtonAddMainWindow(object sender, System.EventArgs e)
{
ListViewEx.kItem k_Item = listFiles.SelectedItem;
if (!k_Item.b_Valid)
return; // nothing selected
frmMain.AddSysObjectToList(k_Item.s_RelPath);
int Pos = listFiles.SelectedItemIndex;
listFiles.Items.RemoveAt(Pos);
rtfBox.Text = "";
listFiles.SelectedItemIndex = Math.Min(Pos, listFiles.Items.Count-1); // Select the next item in the Listview
}
#region Windows Form Designer generated code
private SqlBuilder.Controls.RichTextBoxEx rtfBox;
private SqlBuilder.Controls.ListViewEx listFiles;
private SqlBuilder.Controls.StatusInfo lblStatus;
private System.Windows.Forms.Panel MainPanel;
private System.Windows.Forms.Panel LeftPanel;
private System.Windows.Forms.Splitter SplitterBar;
private System.Windows.Forms.Button btnAdd;
private System.ComponentModel.Container components = null;
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmSearchResult));
this.rtfBox = new SqlBuilder.Controls.RichTextBoxEx();
this.listFiles = new SqlBuilder.Controls.ListViewEx();
this.lblStatus = new SqlBuilder.Controls.StatusInfo();
this.MainPanel = new System.Windows.Forms.Panel();
this.SplitterBar = new System.Windows.Forms.Splitter();
this.LeftPanel = new System.Windows.Forms.Panel();
this.btnAdd = new System.Windows.Forms.Button();
this.MainPanel.SuspendLayout();
this.LeftPanel.SuspendLayout();
this.SuspendLayout();
//
// rtfBox
//
this.rtfBox.DetectUrls = false;
this.rtfBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtfBox.FirstVisibleLine = 1;
this.rtfBox.HideSelection = false;
this.rtfBox.Location = new System.Drawing.Point(253, 0);
this.rtfBox.Name = "rtfBox";
this.rtfBox.Size = new System.Drawing.Size(545, 529);
this.rtfBox.TabIndex = 2;
this.rtfBox.Text = "";
this.rtfBox.TextModified = false;
//
// listFiles
//
this.listFiles.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listFiles.FullRowSelect = true;
this.listFiles.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.listFiles.HideSelection = false;
this.listFiles.Location = new System.Drawing.Point(1, 1);
this.listFiles.Name = "listFiles";
this.listFiles.Size = new System.Drawing.Size(247, 494);
this.listFiles.TabIndex = 1;
this.listFiles.View = System.Windows.Forms.View.Details;
this.listFiles.SelectedIndexChanged += new System.EventHandler(this.OnListFilesSelectedIndexChanged);
this.listFiles.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnListFilesMouseUp);
//
// lblStatus
//
this.lblStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblStatus.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lblStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblStatus.ForeColor = System.Drawing.Color.Blue;
this.lblStatus.Location = new System.Drawing.Point(9, 550);
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(797, 20);
this.lblStatus.TabIndex = 12;
this.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// MainPanel
//
this.MainPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.MainPanel.Controls.Add(this.rtfBox);
this.MainPanel.Controls.Add(this.SplitterBar);
this.MainPanel.Controls.Add(this.LeftPanel);
this.MainPanel.Location = new System.Drawing.Point(9, 14);
this.MainPanel.Name = "MainPanel";
this.MainPanel.Size = new System.Drawing.Size(798, 529);
this.MainPanel.TabIndex = 0;
//
// SplitterBar
//
this.SplitterBar.Location = new System.Drawing.Point(250, 0);
this.SplitterBar.MinSize = 250;
this.SplitterBar.Name = "SplitterBar";
this.SplitterBar.Size = new System.Drawing.Size(3, 529);
this.SplitterBar.TabIndex = 1;
this.SplitterBar.TabStop = false;
//
// LeftPanel
//
this.LeftPanel.Controls.Add(this.btnAdd);
this.LeftPanel.Controls.Add(this.listFiles);
this.LeftPanel.Dock = System.Windows.Forms.DockStyle.Left;
this.LeftPanel.Location = new System.Drawing.Point(0, 0);
this.LeftPanel.Name = "LeftPanel";
this.LeftPanel.Size = new System.Drawing.Size(250, 529);
this.LeftPanel.TabIndex = 0;
//
// btnAdd
//
this.btnAdd.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.btnAdd.Location = new System.Drawing.Point(51, 506);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(150, 23);
this.btnAdd.TabIndex = 3;
this.btnAdd.Text = "Add to main window";
this.btnAdd.Click += new System.EventHandler(this.OnButtonAddMainWindow);
//
// frmSearchResult
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(817, 573);
this.Controls.Add(this.MainPanel);
this.Controls.Add(this.lblStatus);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MinimumSize = new System.Drawing.Size(825, 600);
this.Name = "frmSearchResult";
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = " Search Result";
this.MainPanel.ResumeLayout(false);
this.LeftPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.