void CGrammarManagerFromProgram::SelectMacro(QModelIndex& indexSelected)
{
	QString strMacro = m_modelMacro->index(indexSelected.row(), 0, indexSelected.parent()).data().toString();
	
	/*若为Movl命令*/
	if (strMacro==STR_MACRO_MOVL)
	{
		EditText("MOVL *,*,*");
	}
	/*若为Movc命令*/
	else if (strMacro==STR_MACRO_MOVC)
	{
		EditText("MOVC *,*,*,*");
	}
	/*若为For命令*/
	else if (strMacro==STR_MACRO_FOR_NEXT)
	{
		EditText("FOR *=* TO * STEP *");
	}
	/*若为Switch命令*/
	else if (strMacro==STR_MACRO_SWITCH_DEFAULT_ENDSWITCH)
	{
		EditText("SWITCH *");
	}
	else if (strMacro==STR_MACRO_IF_ENDIF)
	{
		EditText("IF *");
	}
	else if (strMacro==STR_MACRO_CASE)
	{
		EditText("CASE *");
	}
	else if (strMacro==STR_MACRO_DEFAULT)
	{
		EditText("DEFAULT");
	}
	else if (strMacro==STR_MACRO_BREAK)
	{
		EditText("BREAK");
	}
	else if (strMacro==STR_MACRO_ELSEIF)
	{
		EditText("ELSEIF *");
	}
	else if (strMacro==STR_MACRO_GOSUB)
	{
		EditText("GOSUB *");
	}
}
Esempio n. 2
0
static void ExportCB(t_x11 *x11,int dlg_mess,int item_id,
		     char *set,void *data)
{
  bool   bOk;
  t_gmx  *gmx;
  t_dlg  *dlg;

  gmx=(t_gmx *)data;
  dlg=gmx->dlgs[edExport];
  switch (dlg_mess) {
  case DLG_SET:
    switch (item_id) {
    case eExGrom:
      gmx->ExpMode=eExpGromos;
      break;
    case eExPdb:
      gmx->ExpMode=eExpPDB;
      break;
    default:
      break;
    }
#ifdef DEBUG
    fprintf(stderr,"exportcb: item_id=%d\n",item_id);
#endif
    break;
  case DLG_EXIT:
    if ((bOk=(strcasecmp("ok",set))==0)) 
      strcpy(gmx->confout,EditText(dlg,eExConf));
    HideDlg(dlg);
    if (bOk)
      write_gmx(x11,gmx,IDDOEXPORT);
    break;
  }
}
Esempio n. 3
0
void RichEdit::SetStyle()
{
	if(!IsSelection()) {
		NextUndo();
		WithSetStyleLayout<TopWindow> d;
		CtrlLayoutOKCancel(d, t_("Set style"));
		d.newstyle <<= d.Breaker(IDYES);
		d.style.AddKey();
		d.style.AddColumn();
		d.style.NoHeader().NoGrid();
		for(int i = 0; i < text.GetStyleCount(); i++)
			d.style.Add(text.GetStyleId(i), text.GetStyle(i).name);
		d.style.Sort(1, CompareStyle);
		int q = d.style.Find(RichStyle::GetDefaultId());
		if(q >= 0)
			d.style.SetDisplay(q, 0, Single<DisplayDefault>());
		d.style.FindSetCursor(formatinfo.styleid);
		RichStyle cs;
		cs.format = formatinfo;
		cs.format.sscript = 0;
		cs.format.link.Clear();
		cs.format.indexentry.Clear();
		cs.format.language = LNG_ENGLISH;
		cs.format.label.Clear();

		Uuid id;
		switch(d.Run()) {
		case IDCANCEL:
			return;
		case IDOK:
			if(d.style.IsCursor()) {
				id = d.style.GetKey();
				const RichStyle& st = text.GetStyle(id);
				cs.name = st.name;
				cs.next = st.next;
				SaveStyleUndo(id);
				break;
			}
			return;
		case IDYES:
			String newname;
			if(EditText(newname, Format(t_("New style no. %d"), text.GetStyleCount()),
			            "Name", CharFilterAscii128)) {
				cs.name = newname;
				id = Uuid::Create();
				cs.next = id;
				SaveStylesUndo();
				break;
			}
			return;
		}
		text.SetStyle(id, cs);
		ReadStyles();
		formatinfo.styleid = id;
		SaveFormat(GetCursor(), 0);
		text.ReStyle(GetCursor(), id);
		Finish();
	}
}
Esempio n. 4
0
static void Extract(t_dlg *dlg,int ID,char *buf)
{
  char *et;
  
  et=EditText(dlg,ID);
  if (et)
    strcpy(buf,et);
}
Esempio n. 5
0
void WorkspaceWork::AddSeparator()
{
	String active = GetActivePackage();
	if(active.IsEmpty()) return;
	String name;
	if(!EditText(name, "Insert separator", "Name"))
		return;
	AddItem(~name, true, true);
}
Esempio n. 6
0
void Ide::ConditionalBreak()
{
	if(editfile.IsEmpty() || designer)
		return;
	int ln = editor.GetCursorLine();
	String brk = editor.GetBreakpoint(ln);
	if(EditText(brk, "Conditional breakpoint", "Condition"))
		editor.SetBreakpoint(ln, brk);
	editor.RefreshFrame();
}
Esempio n. 7
0
			void GuiDocumentCommonInterface::OnCharInput(compositions::GuiGraphicsComposition* sender, compositions::GuiCharEventArgs& arguments)
			{
				if(documentControl->GetVisuallyEnabled())
				{
					if(editMode==Editable && arguments.code!=VKEY_ESCAPE && arguments.code!=VKEY_BACK && arguments.code!=VKEY_RETURN && !arguments.ctrl)
					{
						Array<WString> text(1);
						text[0]=WString(arguments.code);
						EditText(documentElement->GetCaretBegin(), documentElement->GetCaretEnd(), documentElement->IsCaretEndPreferFrontSide(), text);
					}
				}
			}
Esempio n. 8
0
void DockBase::OnAddNewLayout()
{
	String name;
	if(EditText(name, t_("Add new layout"), t_("Layout name:"), 32))
	{
		if(IsNull(name)) 
		{
			Exclamation(t_("You must enter a name for the new layout"));
			return;
		}
		else if(layouts.Find(name) >= 0)
		{
			if(!PromptOKCancel(Format(t_("Layout '%s' adready exists. Do you want to overwrite it?"), name)))
			return;
		}
		NewWidgetLayout(name);
		RefreshPanel();
	}
}
Esempio n. 9
0
void Ide::ConditionalBreak()
{
	if(editfile.IsEmpty() || designer)
		return;
	int ln = editor.GetCursorLine();
	String brk = editor.GetBreakpoint(ln);
	if(brk == "\xe")
		brk = "1";

	Index<String> cfg = PackageConfig(IdeWorkspace(), 0, GetMethodVars(method), mainconfigparam,
	                                  *CreateHost(true), *CreateBuilder(~CreateHostRunDir()));
#ifdef COMPILER_MSC
	if(cfg.Find("MSC") >= 0) {
		if(EditPDBExpression("Conditional breakpoint", brk, NULL))
			editor.SetBreakpoint(ln, brk);
	}
	else
#endif
	if(EditText(brk, "Conditional breakpoint", "Condition"))
		editor.SetBreakpoint(ln, brk);
	editor.RefreshFrame();
}
Esempio n. 10
0
void   TopicEditor::FixTopic()
{
	String nest;
	if(!EditText(nest, "Fix topic", "Nest"))
		return;
	CppBase& base = CodeBase();
	int q = base.Find(nest);
	if(q < 0) {
		Exclamation("Nest not found");
		return;
	}
	Array<CppItem>& n = base[q];
	Index<String> natural;
	Vector<String> link;
	for(int i = 0; i < n.GetCount(); i++) {
		const CppItem& m = n[i];
		String nat;
		if(m.virt)
			nat << "virtual ";
		if(m.kind == CLASSFUNCTION || m.kind == CLASSFUNCTIONTEMPLATE)
			nat << "static ";
		nat << m.natural;
		natural.Add(nat);
		link.Add(MakeCodeRef(nest, n[i].qitem));
	}
	RichText result;
	const RichText& txt = editor.Get();
	bool started = false;

	int l, h;
	if(editor.GetSelection(l, h)) {
		l = txt.FindPart(l);
		h = txt.FindPart(h);
	}
	else {
		l = 0;
		h = txt.GetPartCount();
	}

	for(int i = 0; i < txt.GetPartCount(); i++)
		if(txt.IsPara(i)) {
			RichPara p = txt.Get(i);
			if(i >= l && i < h) {
				WString h = p.GetText();
				String nat;
				const wchar *s = h;
				while(*s)
					if(*s == 160 || *s == ' ') {
						nat.Cat(' ');
						while(*s == 160 || *s == ' ') s++;
					}
					else
						nat.Cat(*s++);
				int q = nat.GetCount() ? natural.Find(nat) : -1;
				if(q >= 0) {
					started = true;
					const CppItem& m = n[q];
					RichText h = ParseQTF(styles + ("[s7; &]" + CreateQtf(link[q], n[q].name, m, GetLang(), true)));
					if(h.GetPartCount())
						h.RemovePart(h.GetPartCount() - 1);
					result.CatPick(pick(h));
				}
				else
				if(!started || p.GetLength())
					result.Cat(p);
			}
			else
				result.Cat(p);
		}
		else {
			RichTable b;
			b <<= txt.GetTable(i);
			result.CatPick(pick(b));
		}
	RichPara empty;
	result.Cat(empty);
	editor.BeginOp();
	editor.SetSelection(0, txt.GetLength());
	editor.PasteText(result);
}
Esempio n. 11
0
void InterpretCommand(MenuInstanceData * pMenuData, const char *pszScript) {
  char szCmd[31], szParam1[51], szParam2[51];
  char szTempScript[ 255 ];
  memset(szTempScript, 0, sizeof(szTempScript));
  strncpy(szTempScript, pszScript, 250);

  if (pszScript[0] == 0) {
    return;
  }

  char* pszScriptPointer = szTempScript;
  while (pszScriptPointer && !hangup) {
    pszScriptPointer = MenuParseLine(pszScriptPointer, szCmd, szParam1, szParam2);

    if (szCmd[0] == 0) {    // || !pszScriptPointer || !*pszScriptPointer
      break;
    }

    // -------------------------
    // Run a new menu instance

    int nCmdID = GetMenuIndex(szCmd);
    switch (nCmdID) {
    case 0: {
      // "MENU"
      // Spawn a new menu
      MenuInstanceData *pNewMenuData = static_cast<MenuInstanceData *>(malloc(sizeof(MenuInstanceData)));

      memset(pNewMenuData, 0, sizeof(MenuInstanceData));
      pNewMenuData->nFinished = 0;
      pNewMenuData->nReload = 0;

      Menus(pNewMenuData, pMenuData->szPath, szParam1);
      free(pNewMenuData);
    }
    break;
    case 1: {
      // -------------------------
      // Exit out of this instance
      // of the menu
      // -------------------------
      // "ReturnFromMenu"
      InterpretCommand(pMenuData, pMenuData->header.szExitScript);
      pMenuData->nFinished = 1;
    }
    break;
    case 2: {
      // "EditMenuSet"
      EditMenus();           // flag if we are editing this menu
      pMenuData->nFinished = 1;
      pMenuData->nReload = 1;
    }
    break;
    case 3: {
      // "DLFreeFile"
      align(szParam2);
      MenuDownload(szParam1, szParam2, true, true);
    }
    break;
    case 4: {
      // "DLFile"
      align(szParam2);
      MenuDownload(szParam1, szParam2, false, true);
    }
    break;
    case 5: {
      // "RunDoor"
      MenuRunDoorName(szParam1, false);
    }
    break;
    case 6: {
      // "RunDoorFree"
      MenuRunDoorName(szParam1, true);
    }
    break;
    case 7: {
      // "RunDoorNumber"
      int nTemp = atoi(szParam1);
      MenuRunDoorNumber(nTemp, false);
    }
    break;
    case 8: {
      // "RunDoorNumberFree"
      int nTemp = atoi(szParam1);
      MenuRunDoorNumber(nTemp, true);
    }
    break;
    case 9: {
      // "PrintFile"
      printfile(szParam1, true);
    }
    break;
    case 10: {
      // "PrintFileNA"
      printfile(szParam1, false);
    }
    break;
    case 11: {
      // "SetSubNumber"
      SetSubNumber(szParam1);
    }
    break;
    case 12: {
      // "SetDirNumber"
      SetDirNumber(szParam1);
    }
    break;
    case 13: {
      // "SetMsgConf"
      SetMsgConf(szParam1[0]);
    }
    break;
    case 14: {
      // "SetDirConf"
      SetDirConf(szParam1[0]);
    }
    break;
    case 15: {
      // "EnableConf"
      EnableConf();
    }
    break;
    case 16: {
      // "DisableConf"
      DisableConf();
    }
    break;
    case 17: {
      // "Pause"
      pausescr();
    }
    break;
    case 18: {
      // "ConfigUserMenuSet"
      ConfigUserMenuSet();
      pMenuData->nFinished = 1;
      pMenuData->nReload = 1;
    }
    break;
    case 19: {
      // "DisplayHelp"
      if (GetSession()->GetCurrentUser()->IsExpert()) {
        AMDisplayHelp(pMenuData);
      }
    }
    break;
    case 20: {
      // "SelectSub"
      ChangeSubNumber();
    }
    break;
    case 21: {
      // "SelectDir"
      ChangeDirNumber();
    }
    break;
    case 22: {
      // "SubList"
      SubList();
    }
    break;
    case 23: {
      // "UpSubConf"
      UpSubConf();
    }
    break;
    case 24: {
      // "DownSubConf"
      DownSubConf();
    }
    break;
    case 25: {
      // "UpSub"
      UpSub();
    }
    break;
    case 26: {
      // "DownSub"
      DownSub();
    }
    break;
    case 27: {
      // "ValidateUser"
      ValidateUser();
    }
    break;
    case 28: {
      // "Doors"
      Chains();
    }
    break;
    case 29: {
      // "TimeBank"
      TimeBank();
    }
    break;
    case 30: {
      // "AutoMessage"
      AutoMessage();
    }
    break;
    case 31: {
      // "BBSList"
      BBSList();
    }
    break;
    case 32: {
      // "RequestChat"
      RequestChat();
    }
    break;
    case 33: {
      // "Defaults"
      Defaults(pMenuData);
    }
    break;
    case 34: {
      // "SendEMail"
      SendEMail();
    }
    break;
    case 35: {
      // "Feedback"
      FeedBack();
    }
    break;
    case 36: {
      // "Bulletins"
      Bulletins();
    }
    break;
    case 37: {
      // "HopSub"
      HopSub();
    }
    break;
    case 38: {
      // "SystemInfo"
      SystemInfo();
    }
    break;
    case 39: {
      // "JumpSubConf"
      JumpSubConf();
    }
    break;
    case 40: {
      // "KillEMail"
      KillEMail();
    }
    break;
    case 41: {
      // "LastCallers"
      LastCallers();
    }
    break;
    case 42: {
      // "ReadEMail"
      ReadEMail();
    }
    break;
    case 43: {
      // "NewMessageScan"
      NewMessageScan();
    }
    break;
    case 44: {
      // "Goodbye"
      GoodBye();
    }
    break;
    case 45: {
      // "PostMessage"
      WWIV_PostMessage();
    }
    break;
    case 46: {
      // "NewMsgScanCurSub"
      ScanSub();
    }
    break;
    case 47: {
      // "RemovePost"
      RemovePost();
    }
    break;
    case 48: {
      // "TitleScan"
      TitleScan();
    }
    break;
    case 49: {
      // "ListUsers"
      ListUsers();
    }
    break;
    case 50: {
      // "Vote"
      Vote();
    }
    break;
    case 51: {
      // "ToggleExpert"
      ToggleExpert();
    }
    break;
    case 52: {
      // "YourInfo"
      YourInfo();
    }
    break;
    case 53: {
      // "ExpressScan"
      ExpressScan();
    }
    break;
    case 54: {
      // "WWIVVer"
      WWIVVersion();
    }
    break;
    case 55: {
      // "InstanceEdit"
      InstanceEdit();
    }
    break;
    case 56: {
      // "ConferenceEdit"
      JumpEdit();
    }
    break;
    case 57: {
      // "SubEdit"
      BoardEdit();
    }
    break;
    case 58: {
      // "ChainEdit"
      ChainEdit();
    }
    break;
    case 59: {
      // "ToggleAvailable"
      ToggleChat();
    }
    break;
    case 60: {
      // "ChangeUser"
      ChangeUser();
    }
    break;
    case 61: {
      // "CLOUT"
      CallOut();
    }
    break;
    case 62: {
      // "Debug"
      Debug();
    }
    break;
    case 63: {
      // "DirEdit"
      DirEdit();
    }
    break;
    case 65: {
      // "Edit"
      EditText();
    }
    break;
    case 66: {
      // "BulletinEdit"
      EditBulletins();
    }
    break;
    case 67: {
      // "LoadText"
      // LoadText and LoadTextFile are the same, so they are now merged.
      LoadTextFile();
    }
    break;
    case 68: {
      // "ReadAllMail"
      ReadAllMail();
    }
    break;
    case 69: {
      // "Reboot"
      RebootComputer();
    }
    break;
    case 70: {
      // "ReloadMenus"
      ReloadMenus();
    }
    break;
    case 71: {
      // "ResetUserIndex"
      ResetFiles();
    }
    break;
    case 72: {
      // "ResetQScan"
      ResetQscan();
    }
    break;
    case 73: {
      // "MemStat"
      MemoryStatus();
    }
    break;
    case 74: {
      // "PackMsgs"
      PackMessages();
    }
    break;
    case 75: {
      // "VoteEdit"
      InitVotes();
    }
    break;
    case 76: {
      // "Log"
      ReadLog();
    }
    break;
    case 77: {
      // "NetLog"
      ReadNetLog();
    }
    break;
    case 78: {
      // "Pending"
      PrintPending();
    }
    break;
    case 79: {
      // "Status"
      PrintStatus();
    }
    break;
    case 80: {
      // "TextEdit"
      TextEdit();
    }
    break;
    case 81: {
      // "UserEdit"
      UserEdit();
    }
    break;
    case 82: {
      // "VotePrint"
      VotePrint();
    }
    break;
    case 83: {
      // "YLog"
      YesturdaysLog();
    }
    break;
    case 84: {
      // "ZLog"
      ZLog();
    }
    break;
    case 85: {
      // "ViewNetDataLog"
      ViewNetDataLog();
    }
    break;
    case 86: {
      // "UploadPost"
      UploadPost();
    }
    break;
    case 87: {
      // "ClearScreen"
      GetSession()->bout.ClearScreen();
    }
    break;
    case 88: {
      // "NetListing"
      NetListing();
    }
    break;
    case 89: {
      // "WHO"
      WhoIsOnline();
    }
    break;
    case 90: {
      // /A "NewMsgsAllConfs"
      NewMsgsAllConfs();
    }
    break;
    case 91: {
      // /E "MultiEMail"
      MultiEmail();
    }
    break;
    case 92: {
      // "NewMsgScanFromHere"
      NewMsgScanFromHere();
    }
    break;
    case 93: {
      // "ValidatePosts"
      ValidateScan();
    }
    break;
    case 94: {
      // "ChatRoom"
      ChatRoom();
    }
    break;
    case 95: {
      // "DownloadPosts"
      DownloadPosts();
    }
    break;
    case 96: {
      // "DownloadFileList"
      DownloadFileList();
    }
    break;
    case 97: {
      // "ClearQScan"
      ClearQScan();
    }
    break;
    case 98: {
      // "FastGoodBye"
      FastGoodBye();
    }
    break;
    case 99: {
      // "NewFilesAllConfs"
      NewFilesAllConfs();
    }
    break;
    case 100: {
      // "ReadIDZ"
      ReadIDZ();
    }
    break;
    case 101: {
      // "UploadAllDirs"
      UploadAllDirs();
    }
    break;
    case 102: {
      // "UploadCurDir"
      UploadCurDir();
    }
    break;
    case 103: {
      // "RenameFiles"
      RenameFiles();
    }
    break;
    case 104: {
      // "MoveFiles"
      MoveFiles();
    }
    break;
    case 105: {
      // "SortDirs"
      SortDirs();
    }
    break;
    case 106: {
      // "ReverseSortDirs"
      ReverseSort();
    }
    break;
    case 107: {
      // "AllowEdit"
      AllowEdit();
    }
    break;
    case 109: {
      // "UploadFilesBBS"
      UploadFilesBBS();
    }
    break;
    case 110: {
      // "DirList"
      DirList();
    }
    break;
    case 111: {
      // "UpDirConf"
      UpDirConf();
    }
    break;
    case 112: {
      // "UpDir"
      UpDir();
    }
    break;
    case 113: {
      // "DownDirConf"
      DownDirConf();
    }
    break;
    case 114: {
      // "DownDir"
      DownDir();
    }
    break;
    case 115: {
      // "ListUsersDL"
      ListUsersDL();
    }
    break;
    case 116: {
      // "PrintDSZLog"
      PrintDSZLog();
    }
    break;
    case 117: {
      // "PrintDevices"
      PrintDevices();
    }
    break;
    case 118: {
      // "ViewArchive"
      ViewArchive();
    }
    break;
    case 119: {
      // "BatchMenu"
      BatchMenu();
    }
    break;
    case 120: {
      // "Download"
      Download();
    }
    break;
    case 121: {
      // "TempExtract"
      TempExtract();
    }
    break;
    case 122: {
      // "FindDescription"
      FindDescription();
    }
    break;
    case 123: {
      // "ArchiveMenu"
      TemporaryStuff();
    }
    break;
    case 124: {
      // "HopDir"
      HopDir();
    }
    break;
    case 125: {
      // "JumpDirConf"
      JumpDirConf();
    }
    break;
    case 126: {
      // "ListFiles"
      ListFiles();
    }
    break;
    case 127: {
      // "NewFileScan"
      NewFileScan();
    }
    break;
    case 128: {
      // "SetNewFileScanDate"
      SetNewFileScanDate();
    }
    break;
    case 129: {
      // "RemoveFiles"
      RemoveFiles();
    }
    break;
    case 130: {
      // "SearchAllFiles"
      SearchAllFiles();
    }
    break;
    case 131: {
      // "XferDefaults"
      XferDefaults();
    }
    break;
    case 132: {
      // "Upload"
      Upload();
    }
    break;
    case 133: {
      // "YourInfoDL"
      YourInfoDL();
    }
    break;
    case 134: {
      // "UploadToSysop"
      UploadToSysop();
    }
    break;
    case 135: {
      // "ReadAutoMessage"
      ReadAutoMessage();
    }
    break;
    case 136: {
      // "SetNewScanMsg"
      SetNewScanMsg();
    }
    break;
    case 137: {
      // "ReadMessages"
      ReadMessages();
    }
    break;
    /*
    case 138:
    { // "RUN"
    ExecuteBasic(szParam1);
    } break;
    */
    case 139: {
      // "EventEdit"
      EventEdit();
    }
    break;
    case 140: {
      // "LoadTextFile"
      LoadTextFile();
    }
    break;
    case 141: {
      // "GuestApply"
      GuestApply();
    }
    break;
    case 142: {
      // "ConfigFileList"
      ConfigFileList();
    }
    break;
    case 143: {
      // "ListAllColors"
      ListAllColors();
    }
    break;
#ifdef QUESTIONS
    case 144: {
      // "EditQuestions"
      EditQuestions();
    }
    break;
    case 145: {
      // "Questions"
      Questions();
    }
    break;
#endif
    case 146: {
      // "RemoveNotThere"
      RemoveNotThere();
    }
    break;
    case 147: {
      // "AttachFile"
      AttachFile();
    }
    break;
    case 148: {
      // "InternetEmail"
      InternetEmail();
    }
    break;
    case 149: {
      // "UnQScan"
      UnQScan();
    }
    break;
    // ppMenuStringsIndex[150] thru ppMenuStringsIndex[153] not used.....
    case 154: {
      // "Packers"
      Packers();
    }
    break;
    case 155: {
      // Color_Config
      color_config();
    }
    break;
    //------------------------------------------------------------------
    //  ppMenuStringsIndex[156] and [157] are reserved for SDS Systems and systems
    //  that distribute modifications.  DO NOT reuse these strings for
    //  other menu options.
    //------------------------------------------------------------------
    //    case 156:
    //    { // ModAccess
    //        ModsAccess();
    //    } break;
    //    case 157:
    //    { // SDSAccess
    //        SDSAccess();
    //      } break;
    //------------------------------------------------------------------
    case 158: {
      // InitVotes
      InitVotes();
    }
    break;
    case 161: {
      // TurnMCIOn
      TurnMCIOn();
    }
    break;
    case 162: {
      // TurnMCIOff
      TurnMCIOff();
    }
    break;
    default: {
      MenuSysopLog("The following command was not recognized");
      MenuSysopLog(szCmd);
    }
    break;
    }
  }
}
Esempio n. 12
0
//---------------------------------------------------------------------------
void __fastcall TGroundGroupForm::OpenGroundGroupMobile(int X,int Y)
{

 //	int*	ctrlarray;
	char buff[50];

	if (!dialheight[0][0])
    {
    	dialheight[0][0]=Height;
        dialheight[0][1]=Panel1->Top;
        dialheight[0][2]=ButtonPanel->Top;
        int delta=GGPanel->Height;
		dialheight[1][0]=dialheight[0][0]-delta;
		dialheight[1][1]=dialheight[0][1]-delta;
		dialheight[1][2]=dialheight[0][2]-delta;
    }

    Height=dialheight[0][0];
    Panel1->Top=dialheight[0][1];
    ButtonPanel->Top=dialheight[0][2];
	info_grndgrp*	G=*Persons2::ConvertPtrUID(MissionEditor->currobj);

//	MissionEditor->FillComboBox(IDS_CENTRALPOWERS, IDS_ALLIES, NationalityComboBox,
//										G->Nationality);

	UniqueID	uidwp;

		GGAltLabel->Visible = false;
		GGEditAlt->Visible = false;

	int groupindex = -1;
	if (G->shape==ENABLE_COMPLEX_VAL)
    	if (G->shape->type==Expr::EXPR_GLOB)
            FindShapes(G->shape->UsesGlobRef(),groupindex,3);
        else
        	if (G->shape[2]->type==Expr::EXPR_GLOB)
	            FindShapes(G->shape[2]->UsesGlobRef(),groupindex,3);
            else
            	FindShapes(G->shape.Evaluate(2),groupindex,-1);
    else
        FindShapes(G->shape.Evaluate(2),groupindex,-1);
	FillUIDBandList(G->band.Evaluate());
	RefreshText();
    if (MissionEditor->loadedbfs[G->bfieldindex].name[0])
		BfieldLabel->Caption = MissionEditor->loadedbfs[G->bfieldindex].name;
    else
		BfieldLabel->Caption = MissionEditor->loadedbfs[G->bfieldindex].fname;


	UniqueIDBand	uidband;

	if ((int)G->Status.size > (int)ITEMSIZE)
	{
		grndvel = G->vel.Evaluate();
		uidwp=G->wpref;
	}else
	{
		uidwp = UID_Null;
	}

	uidband = Persons2::getbandfromUID(MissionEditor->currobj);

	 int text = MissionEditor->GetBandorShapeText(MissionEditor->currobj);
	 LoadString(HInstance,text,buff,sizeof(buff));
	 Caption = buff;

		GGPanel->Visible = true;
//		ButtonPanel->Top = 147;
//		Height = 284;		//325;

//		MissionEditor->FillComboBox(IDS_CENTRALPOWERS, IDS_ALLIES, NationalityComboBox,
//										G->nationality-1);

		GGSpeedLabel->Visible = true;
		GGSpeedData->Visible = true;
		AltSpinButton->Visible = true;
		SpdComboBox->Visible = true;
		GGFormationSizeLabel->Visible = true;
		GGFormationTypeLabel->Visible = true;
		GGFormationSpinEdit->Visible = true;
		GGFormTypeBox->Visible = true;
		ClassTypeComboBox->Visible = true;
		GG_StatusLabel->Visible = true;
		GG_StatusComboBox->Visible = true;
 //		if 	(	((int)G->shape.Evaluate(2) == (int)TRAIN3)
   //						  || ((int)G->shape.Evaluate(2) == (int)TRAIN4)
	 //		 )
	   //		GG_StatusComboBox->Enabled = false;
		//else
			GG_StatusComboBox->Enabled = true;

		GGEventMore->Visible = false;

	if ((int)G->Status.size > (int)ITEMSIZE)
//	if (uidwp != UID_Null)
	{

		GGRoute->Visible = true;
		GGRoute->Enabled = true;

		SpdComboBox->OnChange = NULL;
		RefreshSpeedInfo();
		SpdComboBox->OnChange = SpdComboBoxChange;


	   int	inform = G->inform.Evaluate();
	   if ( inform == ENABLE_COMPLEX_VAL)			//default set and never been filled in
			inform = 1;


	int maxmobiles = 6;
//		if (	((int)G->shape.Evaluate(2) == (int)BTANK)
  //			||  ((int)G->shape.Evaluate(2) == (int)GTANK)
	//	)
	  //{
		//		if ((int)uidband == (int)RedSAMBAND)
		  //	   {
			//	if ((maxmobiles+MissionEditor->RedTanksCnt-inform) > MissionEditor->RedTanksMax)
			//		maxmobiles = MissionEditor->RedTanksMax - MissionEditor->RedTanksCnt+inform;
		  //	   }else
		//	   {
	  //			if ((maxmobiles+MissionEditor->BlueTanksCnt-inform) > MissionEditor->BlueTanksMax)
	//				maxmobiles = MissionEditor->BlueTanksMax - MissionEditor->BlueTanksCnt+inform;
  //			   }
//		}else
	  {
				if ((int)uidband == (int)GermBoatBAND)
			   {
				if ((maxmobiles+MissionEditor->RedGroundMobilesCnt-inform) > MissionEditor->RedGroundMobilesMax)
					maxmobiles = MissionEditor->RedGroundMobilesMax - MissionEditor->RedGroundMobilesCnt+inform;
			   }else
			   {
				if ((maxmobiles+MissionEditor->BlueGroundMobilesCnt-inform) > MissionEditor->BlueGroundMobilesMax)
					maxmobiles = MissionEditor->BlueGroundMobilesMax - MissionEditor->BlueGroundMobilesCnt+inform;
			   }
	  }
		GGFormationSpinEdit->MaxValue = 15;//maxmobiles;
		GGFormationSpinEdit->Text = IntToStr(inform);

	   int	form = G->form.Evaluate();
	   if ( form == ENABLE_COMPLEX_VAL)			//default set and never been filled in
			form = FTT_LONGLINE;

       int	type = G->type.Evaluate();
       if (	type == ENABLE_COMPLEX_VAL)
       		type= 0;
		MissionEditor->PartFillComboBox(ENUM_Formation,+FTW_MAL,
											GGFormTypeBox,
											form,NULL);
		MissionEditor->PartFillComboBox(ENUM_Type,PT_BADMAX,ClassTypeComboBox,type,NULL);


 //		if (	((int)G->band == (int)BlueSAMBAND)
//			||	((int)G->band == (int)RedSAMBAND)
//			||	((int)G->shape.Evaluate(2) == (int)TROOPS)
//			||	((int)G->shape.Evaluate(2) == (int)TROOP1)
//		   )	
//		 {
//			GGSpeedLabel->Enabled = false;
//			SpdComboBox->Enabled = false;
//			GGSpeedData->Enabled = false;
//		 }else
//		 {
			GGSpeedLabel->Enabled = true;
			SpdComboBox->Enabled = true;  
			GGSpeedData->Enabled = true;
//		 }
			
		GGFormationSizeLabel->Enabled = true;
		GGFormationTypeLabel->Enabled = true;
		GGFormationSpinEdit->Enabled = true;

//		if (	((int)G->shape.Evaluate(2) == (int)TRAIN3)
  //			||  ((int)G->shape.Evaluate(2) == (int)TRAIN4)
	//	 )
	  //	 {
		//		GGFormTypeBox->Enabled = false;
	//		GGFormTypeBox->ItemIndex = IDS_TEXT_SINGLEFILE_FORM-IDS_TEXT_STACKED;
  //		 }
//		 else
			GGFormTypeBox->Enabled = true;
            ClassTypeComboBox->Enabled = true;
			GG_StatusComboBox->ItemIndex = 0;
	}else
	{
		GGRoute->Visible = false;
		GGRoute->Enabled = false;
		SpdComboBox->Enabled = false;
		GGSpeedLabel->Enabled = false;
		GGSpeedData->Enabled = false;
		GGFormationSizeLabel->Enabled = false;
		GGFormationTypeLabel->Enabled = false;
		GGFormationSpinEdit->Value = 1;
		GGFormationSpinEdit->Enabled = false;
		GGFormTypeBox->Enabled = false;
		ClassTypeComboBox->Enabled = false;
		GG_StatusComboBox->ItemIndex = 1;
	}
	MissionEditor->currwp = uidwp;
	int result = GroundGroupForm->ShowModal();
//	MissionEditor->PaintBox->Invalidate();
	switch (result)
	{
		case	mrOk:
		{
//				MissionEditor->MissionEdited=true;

				info_itemS*		curritem =*Persons2::ConvertPtrUID(MissionEditor->currobj);
			MissionEditor->loadedbfs[curritem->bfieldindex].changed=true;

               int shape=ShapeComboBox->ItemIndex;
                if (shape>=0)
                {
                	int shapepage=ShapeCat->ItemIndex;
                	if (shapepage==3)
                    {
                    	GlobRefExpr* gr=new GlobRefExpr(AvailableShapes[3][shape]);
						if (G->shape.complex && G->shape.complex->type==Expr::EXPR_FORM)
							G->shape[2]=gr;
						else
							G->shape = gr;
                    }
                    else
                    {
                    	shape=AvailableShapes[shapepage][shape];
						if (G->shape.complex && G->shape.complex->type==Expr::EXPR_FORM)
							G->shape[2]=shape;
						else
							G->shape = shape;
                    }
                }
 				if (curritem->shape.complex && curritem->shape.complex->type==Expr::EXPR_FORM)
					curritem->shape[2]=shape;
				else
					curritem->shape = shape;
				MissionEditor->ChangeTag(groupindex,shape);

				if ((int)curritem->Status.size > (int)ITEMSIZE)
				{
					info_grndgrp*	G=*Persons2::ConvertPtrUID(MissionEditor->currobj);

//					if (	((int)G->shape.Evaluate(2) == (int)BTANK)
  //						||  ((int)G->shape.Evaluate(2) == (int)GTANK)
	//					)
	  //		   {
		//					if ((int)uidband == (int)RedSAMBAND)
		  //				   {
			//				MissionEditor->RedTanksCnt -=  G->inform;
			  //						G->inform =GGFormationSpinEdit->Value;
			  //				MissionEditor->RedTanksCnt +=  (int)G->inform;
			//				}else
		  //				 {
		//					MissionEditor->BlueTanksCnt -=  G->inform;
	  //								G->inform =GGFormationSpinEdit->Value;
	//						MissionEditor->BlueTanksCnt +=  (int)G->inform;
  //						 }
//					}else
			   {
							if ((int)uidband == (int)GermBoatBAND)
						   {
							MissionEditor->RedGroundMobilesCnt -=  G->inform.Evaluate();
						G->inform =GGFormationSpinEdit->Value;
							MissionEditor->RedGroundMobilesCnt +=  (int)G->inform.Evaluate();
							}else
						 {
							MissionEditor->BlueGroundMobilesCnt -=  G->inform.Evaluate();
						G->inform =GGFormationSpinEdit->Value;
							MissionEditor->BlueGroundMobilesCnt +=  (int)G->inform.Evaluate();
						 }
			   }
					G->form = MissionEditor->FindOrginalIndex(0,FTW_MAL,
									GGFormTypeBox->ItemIndex,NULL);
               		G->type=MissionEditor->FindOrginalIndex(0,PT_BADMAX,
									ClassTypeComboBox->ItemIndex,NULL);
	                G->band= UIDBandList[UIDGroupCombo->ItemIndex];

					if (GGSpeedData->Visible)
					{

						if (MissionEditor->Configure_Units == METRIC)
							G->vel = (MissionEditor->ValidEdit(GGSpeedData) *+VEL_1KMH)+100;
						else if (MissionEditor->Configure_Units == IMPERIAL)
							G->vel = (MissionEditor->ValidEdit(GGSpeedData) * +VEL_1KT)+100;
						else
							G->vel = (MissionEditor->ValidEdit(GGSpeedData) * +VEL_1KMH)+100;
					 }
				}
				EditText();

				break;
		}
		case	mrRoute:
		{

			WayPointForm->ShowWpDialog( 0,0);
			break;
		}
			case	mrDelete:
			{
				AcItemForm->DeleteCurrTransItem();
				break;
			}
	}
	GGCancel->Enabled = true;
//	MissionEditor->MobileSpdButtonState();
	MissionEditor->DisableWPUsageifnecessary();	//rdh 

}
Esempio n. 13
0
//---------------------------------------------------------------------------
void __fastcall TGroundGroupForm::OpenGroundGroupStatic(int X,int Y)
{
	char buff[50];
//    UniqueID CurrUID;
	if (!dialheight[0][0])
    {
    	dialheight[0][0]=Height;
        dialheight[0][1]=Panel1->Top;
        dialheight[0][2]=ButtonPanel->Top;
        int delta=GGPanel->Height;
		dialheight[1][0]=dialheight[0][0]-delta;
		dialheight[1][1]=dialheight[0][1]-delta;
		dialheight[1][2]=dialheight[0][2]-delta;
    }

    Height=dialheight[1][0];
    Panel1->Top=dialheight[1][1];
    ButtonPanel->Top=dialheight[1][2];

		GGAltLabel->Visible = false;
		GGEditAlt->Visible = false;

	UniqueIDBand	uidband;

	uidband = Persons2::getbandfromUID(MissionEditor->currobj);
	ItemBasePtr i=Persons2::ConvertPtrUID(MissionEditor->currobj);


//	MissionEditor->FillComboBox(IDS_CENTRALPOWERS, IDS_ALLIES, NationalityComboBox,
//										i->Nationality);

	info_itemS*	I= *Persons2::ConvertPtrUID(MissionEditor->currobj);
	int groupindex = -1;

	if (I->shape==ENABLE_COMPLEX_VAL)
    	if (I->shape->type==Expr::EXPR_GLOB)
            FindShapes(I->shape->UsesGlobRef(),groupindex,3);
        else
        	if (I->shape[2]->type==Expr::EXPR_GLOB)
	            FindShapes(I->shape[2]->UsesGlobRef(),groupindex,3);
            else
            	FindShapes(I->shape.Evaluate(2),groupindex,-1);
    else
        FindShapes(I->shape.Evaluate(2),groupindex,-1);

	FillUIDBandList(I->band.Evaluate());
//	MissionEditor->FillComboBox(IDS_CENTRALPOWERS, IDS_ALLIES, NationalityComboBox,
//										I->nationality-1);

		GGPanel->Visible = false;
//		ButtonPanel->Top = 38;
//		Height = 181;		//216;

		GGSpeedLabel->Visible = false;
		GGSpeedData->Visible = false;
		AltSpinButton->Visible = false;
		SpdComboBox->Visible = false;


	RefreshText();
    if (MissionEditor->loadedbfs[I->bfieldindex].name[0])
		BfieldLabel->Caption = MissionEditor->loadedbfs[I->bfieldindex].name;
    else
		BfieldLabel->Caption = MissionEditor->loadedbfs[I->bfieldindex].fname;


	switch (uidband)
	{
		case MissileBAND:
		{
			break;
		}
//		case RedGICBAND:
  //		case BlueGICBAND:
	//	{
//		GGAltLabel->Visible = true;
  //		GGEditAlt->Visible = true;
	//	GGPanel->Visible = true;
//		ButtonPanel->Top = 144;
//		Height = 279;
//
  //
    //
//		char	altitude[50];
  //
	//	 LoadString(HInstance,TEXT_ALT,altitude,sizeof(altitude));
//
  //
	//	if (MissionEditor->Configure_Units == METRIC)
//		{
  //		 strcat(altitude,"m");
	//	  GGEditAlt->Text = IntToStr(-i->World.Y/100);
//
  //		}else if (MissionEditor->Configure_Units == IMPERIAL)
	//	{
//			strcat(altitude,"ft");
  //		  GGEditAlt->Text = IntToStr(-(i->World.Y*100-50)/3048);
	//	}else
//		{
  //			strcat(altitude,"ft");
	//	  GGEditAlt->Text = IntToStr(-(i->World.Y*100-50)/3048);
//		}
  //
	//	   GGAltLabel->Caption = altitude;
//		break;
  //		}
	 }
	 int text = MissionEditor->GetBandorShapeText(MissionEditor->currobj);
	 LoadString(HInstance,text,buff,sizeof(buff));
	 Caption = buff;


		GG_StatusLabel->Visible = true;
		GG_StatusComboBox->Visible = true;
		GGEventMore->Visible = false;
		GGRoute->Visible = false;
		GG_StatusComboBox->ItemIndex = 1;
		GG_StatusComboBox->Enabled = false;
		GGRoute->Visible = false;
		GGFormationSizeLabel->Visible = false;
		GGFormationTypeLabel->Visible = false;
		GGFormationSpinEdit->Visible = false;
		GGFormTypeBox->Visible = false;
		ClassTypeComboBox->Visible = false;
		int result = ShowModal();
	   switch (result)
	   {
		   case	mrOk:
		   {
				info_itemS* I=*i;
                MissionEditor->loadedbfs[I->bfieldindex].changed=true;
  //				MissionEditor->MissionEdited=true;
				if (GGEditAlt->Visible)
				{


					if (MissionEditor->Configure_Units == METRIC)
						I->position[0][1] = -MissionEditor->ValidEdit(GGEditAlt) * 100;
					else	if (MissionEditor->Configure_Units == IMPERIAL)
						I->position[0][1] = -MissionEditor->ValidEdit(GGEditAlt) * 3048/100;
					else
						I->position[0][1] = -MissionEditor->ValidEdit(GGEditAlt) * 3048/100;
					I->position.EvalW(I->World);
				 }

                int shape=ShapeComboBox->ItemIndex;
                if (shape>=0)
                {
                	int shapepage=ShapeCat->ItemIndex;
                	if (shapepage==3)
                    {
                    	GlobRefExpr* gr=new GlobRefExpr(AvailableShapes[3][shape]);
						if (I->shape.complex && I->shape.complex->type==Expr::EXPR_FORM)
							I->shape[2]=gr;
						else
							I->shape = gr;
                    }
                    else
                    {
                    	shape=AvailableShapes[shapepage][shape];
						if (I->shape.complex && I->shape.complex->type==Expr::EXPR_FORM)
							I->shape[2]=shape;
						else
							I->shape = shape;
                    }
                }
                I->band= UIDBandList[UIDGroupCombo->ItemIndex];

//				I->nationality= NationalityComboBox->ItemIndex+1;
				MissionEditor->ChangeTag(groupindex,shape);

				EditText();

				break;
		   }
			case	mrDelete:
			{
				AcItemForm->DeleteCurrTransItem();
				break;
			}

		}
	//MissionEditor->MobileSpdButtonState();
	MissionEditor->DisableWPUsageifnecessary();	//rdh


}