Esempio n. 1
0
 private void SaveFile_Function(FTab Tab, bool SAction)
 {
     if (Tab.FileName.Length == 0 || SAction == true)
     {
         SaveFileDialog f = new SaveFileDialog();
         f.AddExtension = true;
         f.OverwritePrompt = true;
         f.ValidateNames = true;
         f.Filter = "Исходный код Pawno|*.pwn|Библиотека Pawn|*.inc";
         f.ShowDialog();
         if (f.FileName.Length > 0)
         {
             File.WriteAllText(f.FileName, Tab.CodeBox.Text, Encoding.Default);
             Tab.FileName = f.FileName;
             StatusBarLabel.Text = String.Format("Файл {0} успешно сохранен.", Path.GetFileName(f.FileName));
             Tab.Changed = false;
             Tab.Text = Path.GetFileName(f.FileName);
         }
     }
     else
     {
         File.WriteAllText(Tab.FileName, Tab.CodeBox.Text, Encoding.Default);
         StatusBarLabel.Text = String.Format("Файл {0} успешно сохранен.", Path.GetFileName(Tab.FileName));
         Tab.Changed = false;
         Tab.Text = Path.GetFileName(Tab.FileName);
     }
 }
Esempio n. 2
0
 private void SaveFile_Function(FTab Tab)
 {
     string fname = Path.GetFileNameWithoutExtension(Tab.FileName) + "_" + DateTime.Now.ToString() + ".pwn";
     if (fname.Length == 0)
         fname = "$" + DateTime.Now.ToString() + "_" + (new Random(100).Next()) + "$.pwn";
     File.WriteAllText(Properties.Settings.Default.PathToRecovery + @"\" + fname, Tab.CodeBox.Text, Encoding.Default);
 }
Esempio n. 3
0
 private void pawncc_Cancel(string output)
 {
     CForm.Hide();
     CompiledTab = CurrentTab;
     listView1.Items.Clear();
     int errors = 0;
     ListViewItem[] items = COutput.ToTable(output, out errors);
     if (items.Length > 0)
         splitContainer3.Panel2Collapsed = false;
     else
         splitContainer3.Panel2Collapsed = true;
     listView1.Items.AddRange(items);
     CurrentTab.CodeBox.ReadOnly = false;
     if (errors == 0)
         StatusBarLabel.Text = "Компиляция успешно завершена.";
     else
         StatusBarLabel.Text = string.Format("Компиляция прервана. Ошибок: {0}, предупреждений: {1}", errors, items.Length - errors);
 }
Esempio n. 4
0
 private FastColoredTextBox NewTab(string name, string fname)
 {
     FTab Tab = new FTab();
     FastColoredTextBox c = NewTextBox(name);
     mainControl.Controls.Add(Tab);
     Tab.Controls.Add(c);
     Tab.CodeBox = c;
     Tab.Text = name;
     Tab.FileName = fname;
     mainControl.SelectedTab = Tab;
     c.ContextMenuStrip = CodeContextMenu;
     CurrentTab = Tab;
     Tab.AutoComp = LoadAutocomplete(Tab.CodeBox);
     ActiveControl = Tab.CodeBox;
     return c;
 }
Esempio n. 5
0
 void mainControl_Selected(object sender, TabControlEventArgs e)
 {
     CurrentTab = e.TabPage as FTab;
     ActiveControl = e.TabPage;
     this.Text = "PawnBox - " + CurrentTab.Text;
 }
Esempio n. 6
0
 void listView1_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     ListViewItem item = listView1.GetItemAt(e.X, e.Y);
     mainControl.SelectedTab = CurrentTab = CompiledTab;
     ActiveControl = CompiledTab.CodeBox;
     if (item != null)
     {
         int line = int.Parse(item.SubItems[1].Text) - 1;
         if (CompiledTab.CodeBox.LinesCount >= line)
             CompiledTab.CodeBox.Navigate(line);
     }
 }
Esempio n. 7
0
 private void CloseTab(FTab Tab)
 {
     if (mainControl.TabPages.Count - 1 == 0)
         this.Close();
     else
         mainControl.TabPages.Remove(mainControl.SelectedTab);
 }