Exemplo n.º 1
0
static void Config(void)
{
  static const struct InitDialogItem PreDialogItems[] =
  {
    {DI_DOUBLEBOX  ,3  ,1  ,50 ,10 ,0               ,MTitle},
    {DI_TEXT       ,5  ,2  ,0  ,0  ,0               ,MPathToViewer},
    {DI_EDIT       ,5  ,3  ,47 ,0  ,DIF_EDITEXPAND  ,-1},
    {DI_TEXT       ,5  ,4  ,0  ,0  ,0               ,MOpenContents},
    {DI_EDIT       ,5  ,5  ,47 ,0  ,0               ,-1},
    {DI_TEXT       ,5  ,6  ,0  ,0  ,0               ,MKeywordSearch},
    {DI_EDIT       ,5  ,7  ,47 ,0  ,0               ,-1},
    {DI_TEXT       ,4  ,8  ,0  ,0  ,DIF_SEPARATOR   ,-1},
    {DI_BUTTON     ,0  ,9  ,0  ,0  ,DIF_CENTERGROUP ,MOk},
    {DI_BUTTON     ,0  ,9  ,0  ,0  ,DIF_CENTERGROUP ,MCancel},
  };
  struct FarDialogItem DialogItems[sizeofa(PreDialogItems)];

  InitDialogItems(PreDialogItems,DialogItems,sizeofa(PreDialogItems));
  DialogItems[2].Focus = TRUE;
  lstrcpy(DialogItems[2].Data,PathToViewer);
  lstrcpy(DialogItems[4].Data,OpenContents);
  lstrcpy(DialogItems[6].Data,KeywordSearch);
  DialogItems[8].DefaultButton = 1;

  if (Info.Dialog(Info.ModuleNumber,-1,-1,54,12,NULL,(struct FarDialogItem *)&DialogItems,sizeofa(DialogItems)) != 8)
    return;

  lstrcpy(PathToViewer,DialogItems[2].Data);
  lstrcpy(OpenContents,DialogItems[4].Data);
  lstrcpy(KeywordSearch,DialogItems[6].Data);

  SetRegKey("PathToViewer",PathToViewer);
  SetRegKey("OpenContents",OpenContents);
  SetRegKey("KeywordSearch",KeywordSearch);
}
Exemplo n.º 2
0
/*
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Folder panel ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» ³
³º [x] Add to Disks menu                                              º ³
³º  _  Disks menu hotkey ('1'-'9'). Leave empty to autoassign         º ³
³º Default folder                                                     º ³
³º __________________________________________________________________ º ³
³ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ³
³                          [ Ok ]  [ Cancel ]                           ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
*/
int Config()
{
	HKEY hKey;
	struct InitDialogItem InitItems[]={
	/*      Type          X1 Y1 X2  Y2 Focus Flags            DefaultButton
	                                      Selected              Data
	*/
	/* 0 */ DI_DOUBLEBOX, 3, 1, 72, 6, 0, 0, 0,               0,(char *)MConfigTitle,
	/* 1 */ DI_CHECKBOX,  5, 2,  0, 0, 0, 0, 0,               0,(char *)MConfigAddToDisksMenu,
	/* 2 */ DI_FIXEDIT,   7, 3,  7, 3, 1, 0, 0,               0,"",
	/* 3 */ DI_TEXT,      9, 3,  0, 0, 0, 0, 0,               0,(char *)MConfigDisksMenuDigit,
	/* 4 */ DI_TEXT,      5, 4,  0, 0, 0, 0, 0,               0,(char *)MDefaultFolder,
	/* 5 */ DI_FIXEDIT,   6, 5, 67, 5, 0, 0, 0,               0,(char *)"",
	/* 6 */ DI_BUTTON,    0, 7,  0, 0, 0, 0, DIF_CENTERGROUP, 1,(char *)MOk,
	/* 7 */ DI_BUTTON,    0, 7,  0, 0, 0, 0, DIF_CENTERGROUP, 0,(char *)MCancel
	};

	struct FarDialogItem DialogItems[sizeof(InitItems)/sizeof(InitItems[0])];

	InitDialogItems(InitItems,DialogItems,sizeof(InitItems)/sizeof(InitItems[0]));
	DialogItems[1].Selected=Opt.AddToDisksMenu;
	if (Opt.DisksMenuDigit)
		wsprintf(DialogItems[2].Data,"%d",Opt.DisksMenuDigit);
	strcpy(DialogItems[5].Data,Opt.DefaultFolder);

	int ExitCode=Info.Dialog(Info.ModuleNumber,-1,-1,75,9,"FolderCfg",
				DialogItems,sizeof(DialogItems)/sizeof(DialogItems[0]));

	if (ExitCode!=6)
		return(FALSE);

	Opt.AddToDisksMenu=DialogItems[1].Selected;
	Opt.DisksMenuDigit=atoi(DialogItems[2].Data);
	strcpy(Opt.DefaultFolder,DialogItems[5].Data);

	DWORD Disposition, DataSize;

	// ¤«ï ᮪à é¥­¨ï ®¡ê¥¬®¢ :-)
	if (RegCreateKeyEx(HKEY_CURRENT_USER,PluginRootKey,0,NULL,0,KEY_WRITE,NULL,&hKey,&Disposition) == ERROR_SUCCESS)
	{
		RegSetValueEx(hKey,AddToDisksMenu,0,REG_DWORD,(BYTE *)&Opt.AddToDisksMenu,sizeof(Opt.AddToDisksMenu));
		RegSetValueEx(hKey,DisksMenuDigit,0,REG_DWORD,(BYTE *)&Opt.DisksMenuDigit,sizeof(Opt.DisksMenuDigit));
		DataSize=511;
		RegSetValueEx(hKey,DefaultFolder,0,REG_SZ,Opt.DefaultFolder,lstrlen(Opt.DefaultFolder)+1);
		RegCloseKey(hKey);
	}

	return TRUE;
}
Exemplo n.º 3
0
void Config(void)
{
  struct InitDialogItem InitItems[] =
  {
    // type, x1, y1, x2, y2, focus, selected, flags, default, data
    { DI_DOUBLEBOX,3, 1,65,6, 0,0,0,0, (char*)mConfig_Title },

    { DI_TEXT,     5, 2, 0,0, 0,0,0,0, (char*)mConfig_DefFiltersDir },
    { DI_EDIT,     5, 3,63,0, 1,0,0,0, NULLSTR },

    {DI_TEXT,3,4,0,0,0,0,DIF_SEPARATOR,0,NULLSTR},

    { DI_BUTTON,  0, 5, 0,0 ,0,0,DIF_CENTERGROUP,1, (char *)mOk },
    { DI_BUTTON,  0, 5, 0,0 ,0,0,DIF_CENTERGROUP,0, (char *)mCancel }
  };
  enum
  {
    C2_FDIR = 2,
    C_TXT,
    C_OK,
    C_CANCEL
  };
  struct FarDialogItem DialogItems[sizeofa(InitItems)];
  InitDialogItems(InitItems,DialogItems,sizeofa(InitItems));

  ReadRegistry();

  lstrcpy( DialogItems[C2_FDIR].Data , DefFiltersDir );

  if ( FarInfo.DialogEx(FarInfo.ModuleNumber,-1,-1,69,8,"Config",DialogItems,sizeofa(DialogItems),0,0,FarMailInfo.ShowHelpDlgProc,(long)FarMailInfo.ModuleName) == C_OK )
  {
    lstrcpyn( DefFiltersDir, DialogItems[C2_FDIR].Data, MAX_PATH);
    if (!*DefFiltersDir)
    {
      char path[MAX_PATH];
      lstrcpy(path,FarMailInfo.ModuleName);
      *(FSF.PointToName(path)) = 0;
      lstrcat(path,"FILTERS\\");
      lstrcpy(DefFiltersDir,path);
    }
    else
    {
      FSF.Unquote(DefFiltersDir);
      FSF.AddEndSlash(DefFiltersDir);
    }

    SetRegKey2( HKEY_CURRENT_USER, PluginRootKey, NULLSTR, DEFFILTERSDIR, DefFiltersDir);
  }
}
Exemplo n.º 4
0
BOOL FTP::WarnExecuteQueue(QueueExecOptions* op)
{
	InitDialogItem InitItems[]=
	{
		{DI_DOUBLEBOX, 3, 1,72, 9, 0, 0,0,0,FMSG(MQueueParam)},

		{DI_CHECKBOX,5, 3,0,0,0,    0,0,0,FMSG(MQRestore)},
		{DI_CHECKBOX,5, 4,0,0,0,    0,0,0,FMSG(MQRemove)},

		{DI_CHECKBOX,5, 6,0,0,0,    0,0,0,FMSG(MQSave)},

		{DI_TEXT,3, 7,3, 7,DIF_BOXCOLOR|DIF_SEPARATOR,0,0,0,NULL },
		{DI_BUTTON,0, 8,0,0,DIF_CENTERGROUP, 0,0,1,   FMSG(MOk)},
		{DI_BUTTON,0, 8,0,0,DIF_CENTERGROUP, 0,0,0,   FMSG(MCancel)},
	};
	FarDialogItem  DialogItems[ARRAYSIZE(InitItems)];
//Create items
	InitDialogItems(InitItems,DialogItems,ARRAYSIZE(DialogItems));
//Set flags
	//Flags
	DialogItems[ 1].Selected = op->RestoreState;
	DialogItems[ 2].Selected = op->RemoveCompleted;

//Dialog
	if(FDialog(76,11,"FTPProcessQueue",DialogItems,ARRAYSIZE(DialogItems)) != 5)
		return FALSE;

//Get paras
	//Flags
	op->RestoreState     = DialogItems[ 1].Selected;
	op->RemoveCompleted  = DialogItems[ 2].Selected;

	//Save to default
	if(DialogItems[ 3].Selected)
	{
		Opt.RestoreState    = op->RestoreState;
		Opt.RemoveCompleted = op->RemoveCompleted;
		FP_SetRegKey("QueueRestoreState",    Opt.RestoreState);
		FP_SetRegKey("QueueRemoveCompleted", Opt.RemoveCompleted);
	}

	return TRUE;
}
Exemplo n.º 5
0
static void Config(void)
{
  static const struct InitDialogItem PreDialogItems[] =
  {
    {DI_DOUBLEBOX  ,3  ,1  ,41 ,6  ,0               ,MTitle},
    {DI_TEXT       ,5  ,2  ,0  ,0  ,0               ,MShowIn},
    {DI_COMBOBOX   ,5  ,3  ,20 ,0  ,DIF_DROPDOWNLIST,-1},
    {DI_COMBOBOX   ,23 ,3  ,38 ,0  ,DIF_DROPDOWNLIST,-1},
    {DI_TEXT       ,4  ,4  ,0  ,0  ,DIF_SEPARATOR   ,-1},
    {DI_BUTTON     ,0  ,5  ,0  ,0  ,DIF_CENTERGROUP ,MOk},
    {DI_BUTTON     ,0  ,5  ,0  ,0  ,DIF_CENTERGROUP ,MCancel},
  };
  struct FarDialogItem DialogItems[sizeofa(PreDialogItems)];

  InitDialogItems(PreDialogItems,DialogItems,sizeofa(PreDialogItems));
  DialogItems[2].Focus = TRUE;
  struct FarListItem li1[2];
  memset(li1,0,sizeof(li1));
  struct FarList fl1 = {2, li1};
  li1[Modality].Flags=LIF_SELECTED;
  GetMsg(MNonModal,li1[0].Text);
  GetMsg(MModal,li1[1].Text);
  DialogItems[2].ListItems = &fl1;
  struct FarListItem li2[2];
  memset(li2,0,sizeof(li2));
  struct FarList fl2 = {2, li2};
  li2[Visuality].Flags=LIF_SELECTED;
  GetMsg(MEditor,li2[0].Text);
  GetMsg(MViewer,li2[1].Text);
  DialogItems[3].ListItems = &fl2;
  DialogItems[5].DefaultButton = 1;

  if (Info.Dialog(Info.ModuleNumber,-1,-1,45,8,NULL,(struct FarDialogItem *)&DialogItems,sizeofa(DialogItems)) != 5)
    return;

  Modality = DialogItems[2].ListPos;
  Visuality = DialogItems[3].ListPos;

  SetRegKey("Modality",Modality);
  SetRegKey("Visuality",Visuality);
}
int Config(void)
{
  static const struct InitDialogItem PreDialogItems[] =
  {
    DI_DOUBLEBOX  ,3  ,1  ,50 ,10 ,0               ,MTitle,
    DI_CHECKBOX   ,5  ,2  ,0  ,0  ,0               ,MEditorAutoPos,
    DI_CHECKBOX   ,5  ,3  ,0  ,0  ,0               ,MCmdAutoPos,
    DI_TEXT       ,4  ,4  ,0  ,0  ,DIF_SEPARATOR   ,-1,
    DI_CHECKBOX   ,5  ,5  ,0  ,0  ,0               ,MCopyToClipboard,
    DI_TEXT       ,4  ,6  ,0  ,0  ,DIF_SEPARATOR   ,-1,
    DI_CHECKBOX   ,5  ,7  ,0  ,0  ,0               ,MEncodeBeforeInsertion,
    DI_TEXT       ,4  ,8  ,0  ,0  ,DIF_SEPARATOR   ,-1,
    DI_BUTTON     ,0  ,9  ,0  ,0  ,DIF_CENTERGROUP ,MOk,
    DI_BUTTON     ,0  ,9  ,0  ,0  ,DIF_CENTERGROUP ,MCancel
  };
  struct FarDialogItem DialogItems[sizeof(PreDialogItems)/sizeof(PreDialogItems[0])];

  InitDialogItems(PreDialogItems,DialogItems,sizeof(PreDialogItems)/sizeof(PreDialogItems[0]));
  DialogItems[1].Focus = TRUE;
  DialogItems[8].DefaultButton = 1;

  DialogItems[1].Selected = EditorAutoPos;
  DialogItems[2].Selected = CmdAutoPos;
  DialogItems[4].Selected = CopyToClipboard;
  DialogItems[6].Selected = EncodeBeforeInsertion;

  if (Info.Dialog(Info.ModuleNumber,-1,-1,54,12,"Configure",(struct FarDialogItem *)&DialogItems,sizeof(PreDialogItems)/sizeof(PreDialogItems[0])) != 8)
    return FALSE;

  EditorAutoPos = DialogItems[1].Selected;
  CmdAutoPos = DialogItems[2].Selected;
  CopyToClipboard = DialogItems[4].Selected;
  EncodeBeforeInsertion = DialogItems[6].Selected;
  SetRegKey(&reg[REG_EDITORAUTOPOS],EditorAutoPos);
  SetRegKey(&reg[REG_CMDAUTOPOS],CmdAutoPos);
  SetRegKey(&reg[REG_COPYTOCLIPBOARD],CopyToClipboard);
  SetRegKey(&reg[REG_ENCODEBEFOREINSERTION],EncodeBeforeInsertion);
  return TRUE;
}
Exemplo n.º 7
0
HANDLE WINAPI OpenW(const struct OpenInfo*)
{
  InitDialogItem InitItems[]=
  {
    //type,x1,y1,x2,y2,focus,selected,flags,default,data
    {DI_DOUBLEBOX,3,1,67,18,0,0,0,0,_T("Very Cool Dialog")},
    {DI_USERCONTROL,4,2,66,17,0,0,0,0,_T("")},
    {DI_BUTTON,3,19,0,0,0,0,0,1,_T("Ok")},
    {DI_BUTTON,12,19,0,0,0,0,0,0,_T("Cancel")},
  };
  FarDialogItem DialogItems[sizeof(InitItems)/sizeof(InitItems[0])];
  InitDialogItems(InitItems,DialogItems,sizeof(InitItems)/sizeof(InitItems[0]));
  FAR_CHAR_INFO *VirtualBuffer=(FAR_CHAR_INFO *)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(DialogItems[1].X2-DialogItems[1].X1+1)*(DialogItems[1].Y2-DialogItems[1].Y1+1)*sizeof(FAR_CHAR_INFO));
  DialogItems[1].VBuf=VirtualBuffer;
  HANDLE hDlg=Info.DialogInit(&MainGuid,&DialogGuid,-1,-1,71,21,NULL,DialogItems,sizeof(DialogItems)/sizeof(DialogItems[0]),0,0,MainDialogProc,0);
  if(hDlg!=INVALID_HANDLE_VALUE)
  {
    Info.DialogRun(hDlg);
    Info.DialogFree(hDlg);
  }
  if(VirtualBuffer) HeapFree(GetProcessHeap(),0,VirtualBuffer);
  return NULL;
}
Exemplo n.º 8
0
int Config()
{
  static const MyInitDialogItem InitItems[]={
  /* 0*/ {DI_DOUBLEBOX, 3, 1,  DIALOG_WIDTH-4,DIALOG_HEIGHT-2, 0, MConfigTitle},

  /* 1*/ {DI_CHECKBOX,  5, 2,  0, 0, 0, MConfigAddToDisksMenu},
  /* 2*/ {DI_FIXEDIT,   7, 3,  7, 3, 0
#ifdef UNICODE
                                      |DIF_HIDDEN
#endif
                                                 , -1},
  /* 3*/ {DI_TEXT,      9, 3,  0, 0, 0
#ifdef UNICODE
                                      |DIF_HIDDEN
#endif
                                                 , MConfigDisksMenuDigit},
  /* 4*/ {DI_CHECKBOX, DC, 2,  0, 0, 0, MConfigAddToPluginsMenu},
  /* 5*/ {DI_TEXT,      5, 4,  0, 0, DIF_BOXCOLOR|DIF_SEPARATOR, -1},

  /* 6*/ {DI_CHECKBOX,  5, 5,  0, 0, 0, MConfigCommonPanel},
  /* 7*/ {DI_CHECKBOX,  5, 6,  0, 0, 0, MSafeModePanel},
  /* 8*/ {DI_CHECKBOX,  5, 7,  0, 0, 0, MAnyInPanel},
  /* 9*/ {DI_CHECKBOX,  5, 8,  0, 0, DIF_3STATE, MCopyContens},
  /*10*/ {DI_CHECKBOX, DC, 5,  0, 0, 0, MReplaceInFilelist},
  /*11*/ {DI_CHECKBOX, DC, 6,  0, 0, 0, MMenuForFilelist},
  /*12*/ {DI_CHECKBOX, DC, 7,  0, 0, 0, MNewPanelForSearchResults},

  /*13*/ {DI_TEXT,      5, 9,  0, 0, DIF_BOXCOLOR|DIF_SEPARATOR, -1},

  /*14*/ {DI_TEXT,      5,10,  0, 0, 0, MColumnTypes},
  /*15*/ {DI_EDIT,      5,11, 36,11, 0, -1},
  /*16*/ {DI_TEXT,      5,12,  0, 0, 0, MColumnWidths},
  /*17*/ {DI_EDIT,      5,13, 36,13, 0, -1},
  /*18*/ {DI_TEXT,     DC,10,  0, 0, 0, MStatusColumnTypes},
  /*19*/ {DI_EDIT,     DC,11, 72,11, 0, -1},
  /*20*/ {DI_TEXT,     DC,12,  0, 0, 0, MStatusColumnWidths},
  /*21*/ {DI_EDIT,     DC,13, 72,13, 0, -1},
  /*22*/ {DI_CHECKBOX,  5,14,  0, 0, 0, MFullScreenPanel},

  /*23*/ {DI_TEXT,      5,15,  0, 0, DIF_BOXCOLOR|DIF_SEPARATOR, -1},

  /*24*/ {DI_TEXT,      5,16,  0, 0, 0, MMask},
  /*25*/ {DI_EDIT,      5,17, 36,17, 0, -1},
  /*26*/ {DI_TEXT,     DC,16,  0, 0, 0, MPrefix},
  /*27*/ {DI_EDIT,     DC,17, 72,17, 0, -1},

  /*28*/ {DI_TEXT,      5,18,  0, 0, DIF_BOXCOLOR|DIF_SEPARATOR, -1},

  /*29*/ {DI_BUTTON,    0,19,  0, 0, DIF_CENTERGROUP,  MOk},
  /*30*/ {DI_BUTTON,    0,19,  0, 0, DIF_CENTERGROUP,  MCancel}
  };

  int i;
  struct FarDialogItem DialogItems[ARRAYSIZE(InitItems)];

  InitDialogItems(InitItems,DialogItems,ARRAYSIZE(InitItems));
  DialogItems[29].DefaultButton=1;
  DialogItems[2].Focus=1;

  GetOptions();
  for(i=AddToDisksMenu;i<=Prefix;i++)
    if (i<ColumnTypes)
      DialogItems[OptionsList[i].DialogItem].Selected=*(int*)(OptionsList[i].Option);
    else
#ifndef UNICODE
      lstrcpy(DialogItems[OptionsList[i].DialogItem].Data,(char*)OptionsList[i].Option);
#else
      DialogItems[OptionsList[i].DialogItem].PtrData = (TCHAR*)OptionsList[i].Option;
#endif

#ifndef UNICODE
  int Ret=Info.Dialog(Info.ModuleNumber,-1,-1,DIALOG_WIDTH,DIALOG_HEIGHT,"Config",
                      DialogItems,ARRAYSIZE(DialogItems));
#else
  HANDLE hDlg=Info.DialogInit(Info.ModuleNumber,-1,-1,DIALOG_WIDTH,DIALOG_HEIGHT,
                      L"Config",DialogItems,ARRAYSIZE(DialogItems),0,0,NULL,0);
  if (hDlg == INVALID_HANDLE_VALUE)
    return FALSE;

  int Ret=Info.DialogRun(hDlg);
#endif

  if((unsigned)Ret >= ARRAYSIZE(InitItems)-1) goto done;

  for(i=AddToDisksMenu;i<=Prefix;i++)
  {
    HKEY hKey;
    DWORD Disposition;
    RegCreateKeyEx(HKEY_CURRENT_USER,PluginRootKey,0,NULL,0,KEY_WRITE,NULL,
                   &hKey,&Disposition);
    if (i<ColumnTypes)
    {
      *((int*)OptionsList[i].Option)=GetCheck(OptionsList[i].DialogItem);
      RegSetValueEx(hKey,REGStr[i],0,REG_DWORD,(BYTE*)OptionsList[i].Option,
        sizeof(int));
    }
    else
    {
      FSF.Trim(lstrcpy((TCHAR*)OptionsList[i].Option,GetDataPtr(OptionsList[i].DialogItem)));
      RegSetValueEx(hKey,REGStr[i],0,REG_SZ,(BYTE*)OptionsList[i].Option,
        sizeof(TCHAR)*(lstrlen((TCHAR*)OptionsList[i].Option)+1));
    }
    RegCloseKey(hKey);
  }
  if(StartupOptFullScreenPanel!=Opt.FullScreenPanel ||
     StartupOptCommonPanel!=Opt.CommonPanel)
  {
    const TCHAR *MsgItems[]={GetMsg(MTempPanel),GetMsg(MConfigNewOption),GetMsg(MOk)};
    Info.Message(Info.ModuleNumber,0,NULL,MsgItems,ARRAYSIZE(MsgItems),1);
  }
done:
#ifdef UNICODE
  Info.DialogFree(hDlg);
#endif
  return((unsigned)Ret<ARRAYSIZE(InitItems));
}
long WINAPI MyDialog(HANDLE hDlg,int Msg,int Param1,long Param2)
{
  static int POpenFrom;
  static unsigned char *Str;
  static int *Ret;
  static COORD coord;
  static int LastSelectedMenu;
  static struct FarMenuItem *MenuItems;
  static int TotalMenuItems;
  static int TargetTable;
  static struct CharTableSet cts;
  static struct TableStruct newtable;
  static struct FarDialogItem DlgASCII, DlgText, DlgEdit, DlgInfo;
  static CHAR_INFO VBufASCII[256];
  static const unsigned char *InfoFormat;
  static BOOL EditMode;
  static int EditInsertMode;
  static char CharTxt[4];
  static int CharTxtPos;
  static char example[MAX_PATH];
  unsigned char Temp[51];
  static int EditLen;
  static unsigned char EditText[512];
  int tmplen;
  unsigned char tmptext[512];
  char *Cmd;
  static struct EditorInfo ei;
  struct FarList *fl;
  struct EditorConvertText ect;
  struct EditorGetString egs;
  struct EditorSetString ess;
  struct EditorSetPosition esp;
  WORD Color;
  int i;

  switch (Msg)
  {
    case DN_INITDIALOG:
      EditMode = FALSE;
      EditLen = 0;
      POpenFrom = ((struct DialogData *)Param2)->OpenFrom;
      Str = ((struct DialogData *)Param2)->Str;
      Ret = ((struct DialogData *)Param2)->Ret;
      MenuItems = NULL;
      GetRegKey(&reg[REG_LASTCOORDX],(int *)&coord.X,0);
      GetRegKey(&reg[REG_LASTCOORDY],(int *)&coord.Y,0);
      for (i=0; GetCharTable(i,&cts) != -1; i++)
      {
        MenuItems=(struct FarMenuItem *)realloc(MenuItems,(i+1)*sizeof(struct FarMenuItem));
        if (!MenuItems)
        {
          Warning(MMemoryError);
          Info.SendDlgMessage(hDlg,DM_CLOSE,0,0);
          return FALSE;
        }
        lstrcpy(MenuItems[i].Text,cts.TableName);
        MenuItems[i].Checked = MenuItems[i].Selected = MenuItems[i].Separator = 0;
      }
      TotalMenuItems = i;
      MenuItems[LastSelectedMenu=0].Selected = 1;
      Info.SendDlgMessage(hDlg,DM_SETCURSORSIZE,3,MAKELONG(1,99));
      InfoFormat = (const unsigned char *) GetMsg(MInfoFormat);
      Info.SendDlgMessage(hDlg,DM_GETDLGITEM,3,(long)&DlgASCII);
      Info.SendDlgMessage(hDlg,DM_GETDLGITEM,1,(long)&DlgText);
      Info.SendDlgMessage(hDlg,DM_GETDLGITEM,5,(long)&DlgEdit);
      Info.SendDlgMessage(hDlg,DM_GETDLGITEM,6,(long)&DlgInfo);
      Color = Info.AdvControl(Info.ModuleNumber,ACTL_GETCOLOR,(void *)COL_DIALOGTEXT);
      Color |= Info.AdvControl(Info.ModuleNumber,ACTL_GETCOLOR,(void *)COL_DIALOGBOX);
      SetVBufAttrib(VBufASCII,Color,256);
      SetVBufAttrib(DlgInfo.VBuf,Color,32);
      {
        struct FarDialogItem DlgDemo;
        char Demo[19*17+1];
        char Space[18];
        Info.SendDlgMessage(hDlg,DM_GETDLGITEM,11,(long)&DlgDemo);
        SetVBufAttrib(DlgDemo.VBuf,Color,19*17);
        FSF.sprintf(Space,"%17s"," ");
        lstrcpy(Demo,"   0123456789ABCDEF");
        for (i=0; i<256; i+=16)
        {
          char Hex[3];
          FSF.sprintf(Hex,x2,i);
          lstrcat(Demo,Hex);
          lstrcat(Demo,Space);
        }
        Demo[19+3] = 32;
        for (i=1; i<256; i++)
        {
          Demo[19+i/16*19+i%16+3] = i;
        }
        SetVBufChars(DlgDemo.VBuf,(unsigned char *)Demo,19*17);
        Info.SendDlgMessage(hDlg,DM_SETDLGITEM,11,(long)&DlgDemo);
      }
      Info.SendDlgMessage(hDlg,DMCM_TABLESELECT,1,0); //Select DOS
      TargetTable = 0; //DOS
      if (POpenFrom == OPENF_EDITOR)
      {
        Info.EditorControl(ECTL_GETINFO,(void *)&ei);
        switch (ei.TableNum)
        {
          case -1:
            if (ei.AnsiMode == 1)
            {
              TargetTable = 1; //WIN
              Info.SendDlgMessage(hDlg,DMCM_TABLESELECT,1,1); //select WIN
            }
            break;

          default:
            if (ei.TableNum < 0)
              break;
            TargetTable = ei.TableNum+2;
            FSF.sprintf(DlgText.Data,s32,MenuItems[ei.TableNum+2].Text);
            MenuItems[LastSelectedMenu].Selected = 0;
            MenuItems[LastSelectedMenu=(ei.TableNum+2)].Selected = 1;
            Info.CharTable(ei.TableNum,(char *)&cts,sizeof(struct CharTableSet));
            Info.SendDlgMessage(hDlg,DM_SETDLGITEM,1,(long)&DlgText);
        }
        if (EditorAutoPos)
        {
          egs.StringNumber = -1;
          Info.EditorControl(ECTL_GETSTRING,(void *)&egs);
          if (egs.StringLength > 0 && ei.CurPos < egs.StringLength)
          {
            i = egs.StringText[ei.CurPos];
            coord.X = i%32;
            coord.Y = i/32;
          }
        }
      }
      if (CmdAutoPos && POpenFrom == OPENF_COMMANDLINE)
      {
        Info.Control(INVALID_HANDLE_VALUE,FCTL_GETCMDLINEPOS,(void *)&i);
        if (i < 1024)
        {
          Cmd = (char *)malloc(1024*sizeof(char));
          if (!Cmd)
          {
            Warning(MMemoryError);
            Info.SendDlgMessage(hDlg,DM_CLOSE,0,0);
            return FALSE;
          }
          Info.Control(INVALID_HANDLE_VALUE,FCTL_GETCMDLINE,(void *)Cmd);
          i = cts.EncodeTable[Cmd[i]];
          coord.X = i%32;
          coord.Y = i/32;
          free(Cmd);
        }
      }
      if (POpenFrom == OPENF_MANUAL)
      {
        i = cts.EncodeTable[*Str];
        coord.X = i%32;
        coord.Y = i/32;
      }
      Info.SendDlgMessage(hDlg,DMCM_REDRAW,1,1);
      return TRUE;

    case DN_KEY:
    {
      long rParam2 = Param2;
      if (Param1==8)
        if (!(Param2==KEY_ESC || Param2==KEY_F10))
          return FALSE;
      if ((Param2&KEY_CTRL)&&((Param2&0xFFL)>='a')&&((Param2&0xFFL)<='z'))
        rParam2&=~0x20L;

      switch (rParam2)
      {
        case KEY_LEFT: (coord.X>0)?--coord.X:((coord.Y>0)?(coord.X=31,--coord.Y):coord.X); break;

        case KEY_RIGHT: (coord.X<31)?++coord.X:((coord.Y<7)?(coord.X=0,++coord.Y):coord.X); break;

        case KEY_UP: if (coord.Y > 0) --coord.Y; break;

        case KEY_DOWN: if (coord.Y < 7) ++coord.Y; break;

        case KEY_HOME: coord.X = 0; break;

        case KEY_END: coord.X = 31; break;

        case KEY_PGUP: coord.Y = 0; break;

        case KEY_PGDN: coord.Y = 7; break;

        case KEY_CTRLHOME: coord.Y = coord.X = 0; break;

        case KEY_CTRLEND: coord.Y = 7; coord.X = 31; break;

        case KEY_ENTER:
          if (!EditMode)
            Info.SendDlgMessage(hDlg,DMCM_ENTER,0,0);
          return TRUE;

        case KEY_SHIFTF8:
          if (!EditMode)
            Info.SendDlgMessage(hDlg,DMCM_TABLESELECT,0,0);
          return TRUE;

        case KEY_F8:
          if (!EditMode)
            Info.SendDlgMessage(hDlg,DMCM_TABLESELECT,2,0); //exchange DOS/WIN
          return TRUE;

        case KEY_SHIFTENTER:
        case KEY_INS:
        case KEY_ADD:
        case KEY_SUBTRACT:
          if (!EditMode && Info.SendDlgMessage(hDlg,DMCM_SETEDIT,0,0))
          {
            switch (Param2)
            {
              case KEY_ADD: (coord.X<31)?++coord.X:((coord.Y<7)?(coord.X=0,++coord.Y):coord.X); break;
              case KEY_SUBTRACT: (coord.X>0)?--coord.X:((coord.Y>0)?(coord.X=31,--coord.Y):coord.X); break;
            }
            break;
          }
          return TRUE;

        case KEY_DEL:
          if (!EditMode)
            Info.SendDlgMessage(hDlg,DMCM_DEL,0,0);
          return TRUE;
        case KEY_BS:
          if (!EditMode)
            Info.SendDlgMessage(hDlg,DMCM_BS,0,0);
          return TRUE;

        case KEY_CTRLINS:
        case KEY_CTRLC:
          if (!EditMode)
          {
            tmplen = EditLen;
            if (tmplen==0)
            {
              EditText[0] = coord.X+32*coord.Y;
              tmplen = 1;
            }
            EditText[tmplen] = 0;
            if (EncodeBeforeInsertion)
            {
              memcpy(tmptext,EditText,tmplen+1);
              Encode((char *)tmptext,tmplen,&cts,TargetTable);
              FSF.CopyToClipboard((const char *)tmptext);
            }
            else
              FSF.CopyToClipboard((const char *)EditText);
          }
          return TRUE;

        case KEY_ALTSHIFTF9:
          Info.SendDlgMessage(hDlg,DM_SHOWDIALOG,FALSE,0);
          Config();
          Info.SendDlgMessage(hDlg,DM_SHOWDIALOG,TRUE,0);
          return TRUE;

        case KEY_F9:
          if (!EditMode)
            Info.SendDlgMessage(hDlg,DMCM_TABLESELECT,3,1);
          break;
        case KEY_SHIFTF9:
          if (!EditMode)
            Info.SendDlgMessage(hDlg,DMCM_TABLESELECT,3,-1);
          break;

        case KEY_CTRLI:
          Info.SendDlgMessage(hDlg,DMCM_SHOWTABLEINFO,0,0);
          return TRUE;

        case KEY_CTRLN:
          if (!EditMode)
            Info.SendDlgMessage(hDlg,DMCM_EDITTABLE,1,0);
          return TRUE;

        case KEY_CTRLE:
          if (!EditMode)
          {
            Info.SendDlgMessage(hDlg,DMCM_EDITTABLE,0,0);
          }
          else
          {
            int xxx;
            const char *XXX;
            EditInsertMode = (EditInsertMode+1)%3;
            xxx=VBufASCII[coord.X+32*coord.Y].Char.AsciiChar;
            switch (EditInsertMode)
            {
              case 0: XXX = x2; break;
              case 1: XXX = d3; break;
              case 2: XXX = c1; break;
            }
            FSF.sprintf(CharTxt,XXX,xxx);
            CharTxtPos = 0;
            Info.SendDlgMessage(hDlg,DM_SETTEXTPTR,7,(long)CharTxt);
            Info.SendDlgMessage(hDlg,DM_SETTEXTPTR,9,(long)GetMsg(MEditModeHex+EditInsertMode));
          }
          return TRUE;

        case KEY_CTRLX:
          if (EditMode)
            Info.SendDlgMessage(hDlg,DMCM_EDITTABLE,0,1);
          return TRUE;

        case KEY_CTRLS:
          if (EditMode)
            Info.SendDlgMessage(hDlg,DMCM_EDITTABLE,1,1);
          return TRUE;

        case KEY_CTRLL:
          if (EditMode)
          {
            static struct InitDialogItem InitItems[]=
            {
              {DI_DOUBLEBOX,3,1,57,4,0,MTitle},
              {DI_TEXT,5,2,0,0,0,MEnterFileName},
              {DI_EDIT,5,3,55,0,0,-1},
              {DI_BUTTON,3,5,0,0,0,MOk},
            };
            struct FarDialogItem DialogItems[4];
            InitDialogItems(InitItems,DialogItems,4);
            DialogItems[3].DefaultButton = 1;
            if (Info.Dialog(Info.ModuleNumber,-1,-1,60,6,NULL,DialogItems,4)!=3)
              break;
            FSF.Unquote(DialogItems[2].Data);
            lstrcpy(example,DialogItems[2].Data);
            LoadFile(example,hDlg,&newtable.cts);
          }
          return TRUE;

        case KEY_CTRLU:
          if (EditMode)
          {
            *example = '\0';
            Info.SendDlgMessage(hDlg,DM_LISTDELETE,8,0);
          }
          return TRUE;

        default:
          if (EditMode)
          {
            BOOL ret=FALSE;
            if (Param2==KEY_ESC||Param2==KEY_F10)
            {
              if (Info.SendDlgMessage(hDlg,DMCM_EDITTABLE,0,1))
              {
                Info.SendDlgMessage(hDlg,DM_CLOSE,0,0);
              }
              return TRUE;
            }
            switch (EditInsertMode)
            {
              case 0: //Hex
                if((Param2>='0' && Param2<='9') || (Param2>='a' && Param2<='f') || (Param2>='A' && Param2<='F'))
                {
                  CharTxt[CharTxtPos++] = Param2;
                  CharTxt[CharTxtPos] = '\0';
                  if (CharTxtPos>1)
                    CharTxtPos=0;
                  FSF.sscanf(CharTxt,"%X",&i);
                  ret=TRUE;
                }
                break;
              case 1: //Decimal
                if((Param2>='0' && Param2<='9'))
                {
                  CharTxt[CharTxtPos++] = Param2;
                  CharTxt[CharTxtPos] = '\0';
                  FSF.sscanf(CharTxt,"%d",&i);
                  if (i>255)
                  {
                    CharTxt[CharTxtPos=0] = Param2;
                    CharTxt[++CharTxtPos] = '\0';
                  }
                  if (CharTxtPos>2)
                    CharTxtPos=0;
                  ret=TRUE;
                }
                break;
              case 2: //Char
                if((Param2>31 && Param2<256))
                {
                  CharTxt[CharTxtPos++] = Param2;
                  CharTxt[CharTxtPos] = '\0';
                  CharTxtPos=0;
                  FSF.sscanf(CharTxt,"%c",&i);
                  ret=TRUE;
                }
            }
            if (ret)
            {
              struct FarListPos lp;
              Info.SendDlgMessage(hDlg,DM_SETTEXTPTR,7,(long)CharTxt);
              VBufASCII[coord.X+32*coord.Y].Char.AsciiChar = i;
              newtable.cts.DecodeTable[coord.X+32*coord.Y] = i;
              Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,8,(long)&lp);
              LoadFile(example,hDlg,&newtable.cts);
              Info.SendDlgMessage(hDlg,DM_LISTSETCURPOS,8,(long)&lp);
              CopyVBufSmart(DlgASCII.VBuf,VBufASCII,256);
              Info.SendDlgMessage(hDlg,DM_SETDLGITEM,3,(long)&DlgASCII);
              Info.SendDlgMessage(hDlg,DMCM_REDRAW,0,1);
              return TRUE;
            }
            return FALSE;
          }
          else
          {
            if (Param2<256 && Param2>31)
            {
              coord.X = Param2%32;
              coord.Y = Param2/32;
              break;
            }
            return FALSE;
          }
      }
      if (EditMode)
      {
        int xxx;
        const char *XXX;
        xxx=VBufASCII[coord.X+32*coord.Y].Char.AsciiChar;
        switch (EditInsertMode)
        {
          case 0: XXX = x2; break;
          case 1: XXX = d3; break;
          case 2: XXX = c1;
        }
        FSF.sprintf(CharTxt,XXX,xxx);
        CharTxtPos = 0;
        Info.SendDlgMessage(hDlg,DM_SETTEXTPTR,7,(long)CharTxt);
      }
      Info.SendDlgMessage(hDlg,DMCM_REDRAW,0,1);
      return TRUE;
    }

    case DN_MOUSECLICK:
      switch (Param1)
      {
        case 3:
          coord = ((MOUSE_EVENT_RECORD *)Param2)->dwMousePosition;
          Info.SendDlgMessage(hDlg,DMCM_REDRAW,0,1);
          if (((MOUSE_EVENT_RECORD *)Param2)->dwButtonState == RIGHTMOST_BUTTON_PRESSED)
          {
            Info.SendDlgMessage(hDlg,DMCM_SETEDIT,0,0);
          }
          else
          {
            if (((MOUSE_EVENT_RECORD *)Param2)->dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED)
              if (((MOUSE_EVENT_RECORD *)Param2)->dwEventFlags & DOUBLE_CLICK)
                Info.SendDlgMessage(hDlg,DMCM_ENTER,0,0);
          }
          return TRUE;

        case 1:
          if (((MOUSE_EVENT_RECORD *)Param2)->dwButtonState == RIGHTMOST_BUTTON_PRESSED)
          {
            Info.SendDlgMessage(hDlg,DMCM_TABLESELECT,2,0);
          }
          else
          {
            if (((MOUSE_EVENT_RECORD *)Param2)->dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED)
            {
              Info.SendDlgMessage(hDlg,DMCM_TABLESELECT,0,0);
            }
          }
          return TRUE;

        case 5:
          if (((MOUSE_EVENT_RECORD *)Param2)->dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED)
          {
              Info.SendDlgMessage(hDlg,DMCM_BS,0,0);
          }
          else
          {
            if (((MOUSE_EVENT_RECORD *)Param2)->dwButtonState == RIGHTMOST_BUTTON_PRESSED)
            {
              Info.SendDlgMessage(hDlg,DMCM_DEL,0,0);
            }
          }
          return TRUE;
      }
      return FALSE;

    case DMCM_REDRAW:
      if (Param1)
      {
        SetVBufChars(VBufASCII,cts.DecodeTable,256);
        CopyVBufSmart(DlgASCII.VBuf,VBufASCII,256);
        Info.SendDlgMessage(hDlg,DM_SETDLGITEM,3,(long)&DlgASCII);
      }
      if (Param1 || Param2)
      {
        i = VBufASCII[coord.X+32*coord.Y].Char.AsciiChar;
        FSF.sprintf((char *)Temp,(const char *)InfoFormat,(unsigned char)(i==0?32:i),(unsigned char)i,(unsigned char)i,(int)(coord.X+32*coord.Y),(int)(coord.X+32*coord.Y));
        SetVBufChars(DlgInfo.VBuf,Temp,32);
        Info.SendDlgMessage(hDlg,DM_SETDLGITEM,6,(long)&DlgInfo);
        Info.SendDlgMessage(hDlg,DM_SETCURSORPOS,3,(long)&coord);
      }
      return TRUE;

    case DMCM_SETEDIT:
      if (EditLen < 511)
      {
        i = VBufASCII[coord.X+32*coord.Y].Char.AsciiChar;
        if (i == 0)
        {
          switch (POpenFrom)
          {
            case OPENF_EDITOR:
            case OPENF_VIEWER:
            case OPENF_MANUAL:
              DlgEdit.Data[EditLen] = 32;
              break;
            default:
              return FALSE;
          }
        }
        else
          DlgEdit.Data[EditLen] = (unsigned char) i;
        EditText[EditLen] = (unsigned char) (coord.X+32*coord.Y);
        DlgEdit.Data[++EditLen] = 0;
        Info.SendDlgMessage(hDlg,DM_SETDLGITEM,5,(long)&DlgEdit);
        return TRUE;
      }
      return FALSE;

    case DMCM_ENTER:
      if (EditLen==0)
      {
        i = VBufASCII[coord.X+32*coord.Y].Char.AsciiChar;
        if (i == 0 && POpenFrom == OPENF_COMMANDLINE)
        {
          //MessageBeep(0);
          return FALSE;
        }
        else
        {
          EditText[0] = (unsigned char) (coord.X+32*coord.Y);
          EditLen = 1;
        }
      }
      EditText[EditLen] = 0;
      if (EncodeBeforeInsertion)
        if (TargetTable != LastSelectedMenu)
          Encode((char *)EditText,EditLen,&cts,TargetTable);
      if (CopyToClipboard)
        FSF.CopyToClipboard((const char *)EditText);
      switch (POpenFrom)
      {
        case OPENF_COMMANDLINE:
          Info.Control(INVALID_HANDLE_VALUE,FCTL_INSERTCMDLINE,(void *)EditText);
          break;
        case OPENF_EDITOR:
          egs.StringNumber = -1;
          Info.EditorControl(ECTL_GETSTRING,(void *)&egs);
          if (ei.CurPos > egs.StringLength)
            ess.StringText = (char *)malloc((egs.StringLength+EditLen+(ei.CurPos-egs.StringLength))*sizeof(char));
          else
            ess.StringText = (char *)malloc((egs.StringLength+EditLen)*sizeof(char));
          if (!ess.StringText)
          {
            Warning(MMemoryError);
            return FALSE;
          }
          if (ei.CurPos > egs.StringLength)
          {
            for (i=egs.StringLength; i<ei.CurPos; i++)
              ess.StringText[i] = cts.EncodeTable[32];
            if (EncodeBeforeInsertion)
              Encode(&ess.StringText[egs.StringLength],ei.CurPos-egs.StringLength,&cts,TargetTable);
            memcpy(ess.StringText,egs.StringText,egs.StringLength);
            memcpy(ess.StringText+ei.CurPos,EditText,EditLen);
            ess.StringLength = EditLen + ei.CurPos;
          }
          else
          {
            memcpy(ess.StringText,egs.StringText,ei.CurPos);
            memcpy(ess.StringText+ei.CurPos,EditText,EditLen);
            memcpy(ess.StringText+ei.CurPos+EditLen,egs.StringText+ei.CurPos,egs.StringLength-ei.CurPos);
            ess.StringLength = EditLen + egs.StringLength;
          }
          ess.StringNumber = -1;
          ess.StringEOL = (char *)egs.StringEOL;
          Info.EditorControl(ECTL_SETSTRING,(void *)&ess);
          esp.CurPos = ei.CurPos + EditLen;
          esp.CurLine = esp.CurTabPos = esp.TopScreenLine = esp.LeftPos = esp.Overtype = -1;
          Info.EditorControl(ECTL_SETPOSITION,(void *)&esp);
          free(ess.StringText);
          break;
        case OPENF_VIEWER:
          break;
        case OPENF_MANUAL:
        {
          memcpy(Str,EditText,EditLen);
          *Ret=EditLen;
        }

      }
      Info.SendDlgMessage(hDlg,DM_CLOSE,0,0);
      return TRUE;

    case DMCM_TABLESELECT:
      if (EditLen > 0)
        return FALSE;
      switch (Param1)
      {
        case 0:
          i = Info.Menu(Info.ModuleNumber,-1,-1,0,FMENU_WRAPMODE|FMENU_AUTOHIGHLIGHT,GetMsg(MTableSelect),NULL,NULL,NULL,NULL,MenuItems,TotalMenuItems);
          break;
        case 1:
          i = Param2;
          break;
        case 2:
          i = (LastSelectedMenu == 1 ? 0 : 1);
          break;
        case 3:
          i = LastSelectedMenu + Param2;
          if (i<0)
            i = TotalMenuItems-1;
          if (i >= TotalMenuItems)
            i = 0;
          break;
      }
      if (i!=-1)
      {
        FSF.sprintf(DlgText.Data,s32,MenuItems[i].Text);
        MenuItems[LastSelectedMenu].Selected = 0;
        MenuItems[LastSelectedMenu=i].Selected = 1;
        GetCharTable(i,&cts);
        Info.SendDlgMessage(hDlg,DM_SETDLGITEM,1,(long)&DlgText);
        Info.SendDlgMessage(hDlg,DMCM_REDRAW,1,0);
        return TRUE;
      }
      return FALSE;

    case DMCM_DEL:
    case DMCM_BS:
      if (EditLen > 0)
      {
        if (Msg == DMCM_DEL)
          EditLen=1;
        DlgEdit.Data[--EditLen] = 0;
        Info.SendDlgMessage(hDlg,DM_SETDLGITEM,5,(long)&DlgEdit);
      }
      return TRUE;

    case DMCM_SHOWTABLEINFO:
      {
        struct InitDialogItem InitItems[]=
        {
          {DI_DOUBLEBOX,3,1,57,8,0,MTitle},
          {DI_TEXT,5,2,0,0,0,MTableName},
          {DI_EDIT,5,3,55,0,0,-1},
          {DI_TEXT,5,4,0,0,0,MStatusTableName},
          {DI_EDIT,5,5,55,0,0,-1},
          {DI_TEXT,5,6,0,0,0,MRFCCharset},
          {DI_EDIT,5,7,55,0,0,-1},
          {DI_BUTTON,3,9,0,0,0,MOk},
        };
        struct FarDialogItem DialogItems[8];
        if (Param1||EditMode)
          InitItems[0].Data=MEnterTableInfo;
        InitDialogItems(InitItems,DialogItems,8);
        DialogItems[7].DefaultButton = 1;
        lstrcpy(DialogItems[2].Data,EditMode?newtable.cts.TableName:(Param1?"":cts.TableName));
        if (!EditMode)
        {
          if (!Param1)
          {
            DialogItems[2].Flags|=DIF_READONLY;
            for (i=4; i<=6; i+=2)
            {
              DialogItems[i].Flags|=DIF_READONLY;
              lstrcpy(DialogItems[i].Data,GetMsg(MUnavailable));
            }
          }
        }
        else
        {
          lstrcpy(DialogItems[4].Data,newtable.ShortName);
          lstrcpy(DialogItems[6].Data,newtable.RFCName);
        }
        if (Info.Dialog(Info.ModuleNumber,-1,-1,60,10,NULL,DialogItems,8)!=7)
          return FALSE;
        if (EditMode||Param1)
        {
          lstrcpyn(newtable.cts.TableName,DialogItems[2].Data,128);
          lstrcpyn(newtable.ShortName,DialogItems[4].Data,128);
          lstrcpyn(newtable.RFCName,DialogItems[6].Data,128);
          FSF.sprintf(DlgText.Data,s32,*(newtable.cts.TableName)?newtable.cts.TableName:newtable.ShortName);
          Info.SendDlgMessage(hDlg,DM_SETDLGITEM,1,(long)&DlgText);
        }
      }
      return TRUE;

    case DMCM_EDITTABLE:
      if (Param2==0)
      {
        SMALL_RECT sr;
        COORD dcoord;
        if (Param1)
        {
          Info.SendDlgMessage(hDlg,DMCM_TABLESELECT,1,0);
          newtable.cts=cts;
          *newtable.ShortName='\0';
          *newtable.RFCName='\0';
          Info.SendDlgMessage(hDlg,DMCM_SHOWTABLEINFO,1,0);
        }
        else
        {
          newtable.cts=cts;
          *newtable.ShortName='\0';
          *newtable.RFCName='\0';
        }
        dcoord.X = 61; dcoord.Y=25;
        Info.SendDlgMessage(hDlg,DM_RESIZEDIALOG,0,(long)&dcoord);
        sr.Left = 3; sr.Top=1; sr.Right=36; sr.Bottom=23;
        Info.SendDlgMessage(hDlg,DM_SETITEMPOSITION,0,(long)&sr);
        Info.SendDlgMessage(hDlg,DM_SHOWITEM,5,0);
        Info.SendDlgMessage(hDlg,DM_SHOWITEM,8,1);
        Info.SendDlgMessage(hDlg,DM_SHOWITEM,7,1);
        Info.SendDlgMessage(hDlg,DM_SHOWITEM,9,1);
        Info.SendDlgMessage(hDlg,DM_SHOWITEM,10,1);
        Info.SendDlgMessage(hDlg,DM_SHOWITEM,11,1);
        *example = '\0';
        Info.SendDlgMessage(hDlg,DM_LISTDELETE,8,0);
        EditInsertMode = 0;
        i=VBufASCII[coord.X+32*coord.Y].Char.AsciiChar;
        FSF.sprintf(CharTxt,x2,i);
        CharTxtPos = 0;
        Info.SendDlgMessage(hDlg,DM_SETTEXTPTR,7,(long)CharTxt);
        Info.SendDlgMessage(hDlg,DM_SETTEXTPTR,9,(long)GetMsg(MEditModeHex+EditInsertMode));
        Info.SendDlgMessage(hDlg,DMCM_REDRAW,1,0);
        EditMode=TRUE;
      }
      else
      {
        if (Param1)
        {
          static struct InitDialogItem InitItems[]=
          {
            {DI_DOUBLEBOX,3,1,57,4,0,MTitle},
            {DI_TEXT,5,2,0,0,0,MSaveToFile},
            {DI_EDIT,5,3,55,0,0,-1},
            {DI_BUTTON,3,5,0,0,0,MOk},
          };
          struct FarDialogItem DialogItems[4];
          InitDialogItems(InitItems,DialogItems,4);
          DialogItems[3].DefaultButton = 1;
          lstrcpy(DialogItems[2].Data,*(newtable.cts.TableName)?newtable.cts.TableName:newtable.ShortName);
          lstrcat(DialogItems[2].Data,".reg");
          if (Info.Dialog(Info.ModuleNumber,-1,-1,60,6,NULL,DialogItems,4)==3)
          {
            HANDLE fp;
            DWORD transfered;
            char buf[256];
            FSF.Unquote(DialogItems[2].Data);
            fp = CreateFile(DialogItems[2].Data,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL);
            if (fp==INVALID_HANDLE_VALUE)
            {
              Warning(MFileError);
              return FALSE;
            }
            lstrcpy(buf,"REGEDIT4\r\n[HKEY_CURRENT_USER\\Software\\Far\\CodeTables\\");
            WriteFile(fp,buf,lstrlen(buf),&transfered,NULL);
            lstrcpy(buf,*(newtable.ShortName)?newtable.ShortName:newtable.cts.TableName);
            WriteFile(fp,buf,lstrlen(buf),&transfered,NULL);
            lstrcpy(buf,"]\r\n");
            WriteFile(fp,buf,lstrlen(buf),&transfered,NULL);
            if (*(newtable.cts.TableName)&&*(newtable.ShortName))
            {
              lstrcpy(buf,"\"TableName\"=\"");
              WriteFile(fp,buf,lstrlen(buf),&transfered,NULL);
              lstrcpy(buf,newtable.cts.TableName);
              WriteFile(fp,buf,lstrlen(buf),&transfered,NULL);
              lstrcpy(buf,"\"\r\n");
              WriteFile(fp,buf,lstrlen(buf),&transfered,NULL);
            }
            if (*(newtable.RFCName))
            {
              lstrcpy(buf,"\"RFCCharset\"=\"");
              WriteFile(fp,buf,lstrlen(buf),&transfered,NULL);
              lstrcpy(buf,newtable.RFCName);
              WriteFile(fp,buf,lstrlen(buf),&transfered,NULL);
              lstrcpy(buf,"\"\r\n");
              WriteFile(fp,buf,lstrlen(buf),&transfered,NULL);
            }
            lstrcpy(buf,"\"Mapping\"=hex:\\\r\n");
            WriteFile(fp,buf,lstrlen(buf),&transfered,NULL);
            for (i=0; i<16; i++)
            {
              int j;
              *buf = '\0';
              for (j=0; j<16; j++)
              {
                char hex[4];
                FSF.sprintf(hex,"%02X,",newtable.cts.DecodeTable[i*16+j]);
                lstrcat(buf,hex);
              }
              if ((i*16+j)<255)
                lstrcat(buf,"\\");
              else
                buf[lstrlen(buf)-1] = '\0';
              lstrcat(buf,"\r\n");
              WriteFile(fp,buf,lstrlen(buf),&transfered,NULL);
            }
            CloseHandle(fp);
          }
        }
        else
        {
          SMALL_RECT sr;
          COORD coord;
          const char *Msg[2];
          Msg[0] = GetMsg(MTitle);
          Msg[1] = GetMsg(MSureToExit);
          i = Info.Message(Info.ModuleNumber,FMSG_WARNING|FMSG_MB_YESNO,NULL,Msg,2,0);
          if (i==1 || i==-1)
            return FALSE;
          Info.SendDlgMessage(hDlg,DM_LISTDELETE,8,0);
          Info.SendDlgMessage(hDlg,DM_SHOWITEM,8,0);
          Info.SendDlgMessage(hDlg,DM_SHOWITEM,9,0);
          Info.SendDlgMessage(hDlg,DM_SHOWITEM,7,0);
          Info.SendDlgMessage(hDlg,DM_SHOWITEM,10,0);
          Info.SendDlgMessage(hDlg,DM_SHOWITEM,11,0);
          Info.SendDlgMessage(hDlg,DM_SHOWITEM,5,1);
          sr.Left = 3; sr.Top=1; sr.Right=36; sr.Bottom=15;
          Info.SendDlgMessage(hDlg,DM_SETITEMPOSITION,0,(long)&sr);
          coord.X = 40; coord.Y=17;
          Info.SendDlgMessage(hDlg,DM_RESIZEDIALOG,0,(long)&coord);
          Info.SendDlgMessage(hDlg,DMCM_TABLESELECT,1,0);
          Info.SendDlgMessage(hDlg,DMCM_REDRAW,1,0);
          EditMode=FALSE;
        }
      }
      return TRUE;

    case DN_CLOSE:
      if (MenuItems)
        free(MenuItems);
      SetRegKey(&reg[REG_LASTCOORDX],coord.X);
      SetRegKey(&reg[REG_LASTCOORDY],coord.Y);
      return TRUE;

  }
  return Info.DefDlgProc(hDlg,Msg,Param1,Param2);
}
Exemplo n.º 10
0
HANDLE WINAPI _export OpenPlugin(int OpenFrom,int item)
{

  CHAR_INFO VBufASCII[256], VBufInfo[32], VBufDemo[19*17];
  static const struct InitDialogItem PreDialogItems[] =
  {
    DI_DOUBLEBOX   ,3  ,1  ,36 ,15 ,0                  ,MTitle,
    DI_TEXT        ,4  ,2  ,0  ,0  ,DIF_SHOWAMPERSAND  ,-1,
    DI_TEXT        ,3  ,3  ,0  ,0  ,0                  ,MSeparator,
    DI_USERCONTROL ,4  ,4  ,35 ,11 ,0                  ,-1,
    DI_TEXT        ,3  ,12 ,0  ,0  ,0                  ,MSeparator,
    DI_EDIT        ,4  ,13 ,35 ,0  ,DIF_NOFOCUS        ,-1,
    DI_USERCONTROL ,4  ,14 ,35 ,14 ,DIF_NOFOCUS        ,-1,
    DI_FIXEDIT     ,4  ,13 ,6  ,0  ,DIF_NOFOCUS|DIF_HIDDEN ,-1,
    DI_LISTBOX     ,4  ,15 ,35 ,22 ,DIF_HIDDEN|DIF_LISTNOCLOSE ,-1,
    DI_TEXT        ,7  ,13 ,35 ,0  ,DIF_HIDDEN         ,-1,
    DI_DOUBLEBOX   ,37 ,3  ,57 ,21 ,DIF_HIDDEN         ,-1,
    DI_USERCONTROL ,38 ,4  ,56 ,20 ,DIF_HIDDEN|DIF_NOFOCUS ,-1,
  };
  struct FarDialogItem DialogItems[sizeof(PreDialogItems)/sizeof(PreDialogItems[0])];
  struct WindowInfo wi;
  struct DialogData dd;
  int Ret;

  wi.Pos=-1;
  Info.AdvControl(Info.ModuleNumber,ACTL_GETWINDOWINFO,&wi);

  dd.OpenFrom = -1;
  switch (OpenFrom)
  {
    case OPEN_PLUGINSMENU:
      if (wi.Type==WTYPE_PANELS)
        dd.OpenFrom = OPENF_COMMANDLINE;
      break;
    case OPEN_EDITOR:
      if (wi.Type==WTYPE_EDITOR)
        dd.OpenFrom = OPENF_EDITOR;
      break;
    case OPEN_VIEWER:
      if (wi.Type==WTYPE_VIEWER)
        dd.OpenFrom = OPENF_VIEWER;
      break;
    case OPEN_MANUAL:
      if (item)
      {
        dd.OpenFrom = OPENF_MANUAL;
        dd.Str = (unsigned char *)item;
        Ret = 0;
        dd.Ret = &Ret;
      }
      break;
  }
  if (dd.OpenFrom<0)
    return INVALID_HANDLE_VALUE;

  InitDialogItems(PreDialogItems,DialogItems,sizeof(PreDialogItems)/sizeof(PreDialogItems[0]));

  DialogItems[3].Focus = TRUE;
  DialogItems[3].VBuf = VBufASCII;
  DialogItems[5].Data[0] = 0;
  DialogItems[6].VBuf = VBufInfo;
  DialogItems[8].ListItems = NULL;
  DialogItems[11].VBuf = VBufDemo;

  Info.DialogEx(Info.ModuleNumber,-1,-1,40,17,"Contents",(struct FarDialogItem *)&DialogItems,sizeof(PreDialogItems)/sizeof(PreDialogItems[0]),0,0,MyDialog,(int)&dd);

  if (dd.OpenFrom == OPENF_MANUAL)
    return (HANDLE)Ret;
  return INVALID_HANDLE_VALUE;
}
Exemplo n.º 11
0
int PluginClass::GetFiles(PluginPanelItem *PanelItem, int ItemsNumber,
                          int Move, char *DestPath, int OpMode)
{
  //костыль против зацикливания в FAR'е при Quick View архивов с паролем
  TRecur Recur;   //$ 07.04.2002 AA
  if(Recur.Count>1 && OpMode&(OPM_VIEW|OPM_QUICKVIEW))
    return 0;

  char SaveDir[NM];
  GetCurrentDirectory(sizeof(SaveDir),SaveDir);
  char Command[512],AllFilesMask[32];
  if (ItemsNumber==0)
    return /*0*/1; //$ 07.02.2002 AA чтобы многотомные CABы нормально распаковывались
  if (*DestPath)
    FSF.AddEndSlash(DestPath);
  const char *PathHistoryName="ExtrDestPath";
  InitDialogItem InitItems[]={
  /* 0 */{DI_DOUBLEBOX,3,1,72,13,0,0,0,0,(char *)MExtractTitle},
  /* 1 */{DI_TEXT,5,2,0,0,0,0,0,0,(char *)MExtractTo},
  /* 2 */{DI_EDIT,5,3,70,3,1,(DWORD_PTR)PathHistoryName,DIF_HISTORY,0,DestPath},
  /* 3 */{DI_TEXT,3,4,0,0,0,0,DIF_BOXCOLOR|DIF_SEPARATOR,0,""},
  /* 4 */{DI_TEXT,5,5,0,0,0,0,0,0,(char *)MExtrPassword},
  /* 5 */{DI_PSWEDIT,5,6,35,5,0,0,0,0,""},
  /* 6 */{DI_TEXT,3,7,0,0,0,0,DIF_BOXCOLOR|DIF_SEPARATOR,0,""},
  /* 7 */{DI_CHECKBOX,5,8,0,0,0,0,0,0,(char *)MExtrWithoutPaths},
  /* 8 */{DI_CHECKBOX,5,9,0,0,0,0,0,0,(char *)MBackground},
  /* 9 */{DI_CHECKBOX,5,10,0,0,0,0,0,0,(char *)MExtrDel},
  /*10 */{DI_TEXT,3,11,0,11,0,0,DIF_BOXCOLOR|DIF_SEPARATOR,0,""},
  /*11 */{DI_BUTTON,0,12,0,0,0,0,DIF_CENTERGROUP,1,(char *)MExtrExtract},
  /*12 */{DI_BUTTON,0,12,0,0,0,0,DIF_CENTERGROUP,0,(char *)MExtrCancel},
  };

  FarDialogItem DialogItems[ARRAYSIZE(InitItems)];
  InitDialogItems(InitItems,DialogItems,ARRAYSIZE(InitItems));

  int AskVolume=(OpMode & (OPM_FIND|OPM_VIEW|OPM_EDIT))==0 &&
                CurArcInfo.Volume && *CurDir==0;

  if (!AskVolume)
  {
    DialogItems[7].Selected=TRUE;
    for (int I=0;I<ItemsNumber;I++)
      if (PanelItem[I].FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
      {
        DialogItems[7].Selected=FALSE;
        break;
      }
  }

  Opt.UserBackground=0; // $ 14.02.2001 raVen //сброс галки "фоновая архивация"
  if ((OpMode & ~OPM_SILENT) & ~OPM_TOPLEVEL)
    Opt.OldUserBackground=0; // $ 03.07.02 AY: если OPM_SILENT но не из за Shift-F2 при несколько выбраных архивах
  DialogItems[8].Selected=Opt.UserBackground;
  DialogItems[9].Selected=Move;

  if ((OpMode & OPM_SILENT)==0)
  {
    int AskCode=Info.Dialog(Info.ModuleNumber,-1,-1,76,15,"ExtrFromArc",
                DialogItems,ARRAYSIZE(DialogItems));
    if (AskCode!=11)
      return -1;
    lstrcpy(DestPath,DialogItems[2].Data);
    FSF.Unquote(DestPath);
    Opt.UserBackground=DialogItems[8].Selected;
    Opt.OldUserBackground=Opt.UserBackground; // $ 02.07.2002 AY: запомним и не будем не где сбрасывать
    //SetRegKey(HKEY_CURRENT_USER,"","Background",Opt.UserBackground); // $ 06.02.2002 AA
  }

  LastWithoutPathsState=DialogItems[7].Selected;

  Opt.Background=OpMode & OPM_SILENT ? Opt.OldUserBackground : Opt.UserBackground; // $ 02.07.2002 AY: Если OPM_SILENT значит выбрано несколько архивов

  /*int SpaceOnly=TRUE;
  for (int I=0;DestPath[I]!=0;I++)
    if (DestPath[I]!=' ')
    {
      SpaceOnly=FALSE;
      break;
    }

  if (!SpaceOnly)
  {
    for (char *ChPtr=DestPath;*ChPtr!=0;ChPtr++)
      if (*ChPtr=='\\')
      {
        *ChPtr=0;
        CreateDirectory(DestPath,NULL);
        *ChPtr='\\';
      }
    CreateDirectory(DestPath,NULL);
  }*/
  CreateDirectory(DestPath); //$ 16.05.2002 AA


  if (*DestPath && DestPath[lstrlen(DestPath)-1]!=':')
    FSF.AddEndSlash(DestPath);
  GetCommandFormat(CMD_ALLFILESMASK,AllFilesMask,sizeof(AllFilesMask));

  PluginPanelItem MaskPanelItem;

  if (AskVolume)
  {
    char VolMsg[300];
    int MsgCode;

    /*if(OpMode & OPM_TOPLEVEL) // $ 16.02.2002 AA
    {
      //?? есть разница между извлечением выделенных файлов тома и
      //извлечением из выделенных томов. здесь можно ее учесть.
      //как минимум - нужно изменить надпись в мессаджбоксе
      MsgCode=1;
    }
    else        */
    {
      char NameMsg[NM];
      FSF.TruncPathStr(lstrcpyn(NameMsg,FSF.PointToName(ArcName),sizeof(NameMsg)),MAX_WIDTH_MESSAGE);
      FSF.sprintf(VolMsg,GetMsg(MExtrVolume),FSF.PointToName(NameMsg));
      const char *MsgItems[]={GetMsg(MExtractTitle),VolMsg,GetMsg(MExtrVolumeAsk1),
                        GetMsg(MExtrVolumeAsk2),GetMsg(MExtrVolumeSelFiles),
                        GetMsg(MExtrAllVolumes)};
      MsgCode=Info.Message(Info.ModuleNumber,0,NULL,MsgItems,ARRAYSIZE(MsgItems),2);
    }
    if (MsgCode<0)
      return -1;
    if (MsgCode==1)
    {
      memset(&MaskPanelItem,0,sizeof(MaskPanelItem));
      lstrcpy(MaskPanelItem.FindData.cFileName,AllFilesMask);
      lstrcpy(MaskPanelItem.FindData.cAlternateFileName,AllFilesMask);
      if (ItemsInfo.Encrypted)
        MaskPanelItem.Flags=F_ENCRYPTED;
      PanelItem=&MaskPanelItem;
      ItemsNumber=1;
    }
  }

  int CommandType=LastWithoutPathsState ? CMD_EXTRACTWITHOUTPATH:CMD_EXTRACT;
  GetCommandFormat(CommandType,Command,sizeof(Command));

  if (*DialogItems[5].Data==0 && strstr(Command,"%%P")!=NULL)
    for (int I=0;I<ItemsNumber;I++)
      if ((PanelItem[I].Flags & F_ENCRYPTED) || (ItemsInfo.Encrypted &&
          (PanelItem[I].FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)))
      {
        if(OpMode&OPM_FIND || !GetPassword(DialogItems[5].Data,FSF.PointToName(ArcName)))
          return -1;
        break;
      }

  SetCurrentDirectory(DestPath);
  int SaveHideOut=Opt.HideOutput;
  if (OpMode & OPM_FIND)
    Opt.HideOutput=2;
  int IgnoreErrors=(CurArcInfo.Flags & AF_IGNOREERRORS);

  ArcCommand ArcCmd(PanelItem,ItemsNumber,Command,ArcName,CurDir,
             DialogItems[5].Data,AllFilesMask,IgnoreErrors,
             (OpMode & OPM_VIEW)!=0,(OpMode & OPM_FIND),CurDir);

  //последующие операции (тестирование и тд) не должны быть фоновыми
  Opt.Background=0; // $ 06.02.2002 AA

  Opt.HideOutput=SaveHideOut;
  SetCurrentDirectory(SaveDir);
  if (!IgnoreErrors && ArcCmd.GetExecCode()!=0)
    if (!(OpMode & OPM_VIEW))
      return 0;

  if (DialogItems[9].Selected)
    DeleteFiles(PanelItem,ItemsNumber,TRUE);

  if (Opt.UpdateDescriptions)
    for (int I=0;I<ItemsNumber;I++)
      PanelItem[I].Flags|=PPIF_PROCESSDESCR;

  return 1;
}
Exemplo n.º 12
0
intptr_t WINAPI ConfigureW(const struct ConfigureInfo *Info)
{
	struct InitDialogItem InitItems[]={
		/*00*/FDI_DOUBLEBOX (47,20,(farStr *)MConfTitle),
		/*01*/FDI_CHECK			( 2, 2,(farStr *)MConfAddToDisk),
		/*02*/FDI_LABEL			( 2, 3, (farStr *)MConfPrefix),
		/*03*/FDI_EDIT			(10, 3,20, _F("fardroidPrefix")),
		/*04*/FDI_RADIO			( 2, 5, (farStr*)MConfSafeMode),
		/*05*/FDI_RADIO			( 2, 6, (farStr*)MConfNative),
		/*06*/FDI_RADIO			( 2, 7, (farStr*)MConfBusybox),
		/*07*/FDI_CHECK			( 4, 8, (farStr*)MConfShowLinksAsDirs),
		/*08*/FDI_CHECK			( 2,10, (farStr*)MConfShowAllFilesystems),
		/*09*/FDI_CHECK			( 2,11, (farStr*)MConfUseSU),
		/*10*/FDI_CHECK			( 4,12, (farStr*)MConfUseExtendedAccess),
		/*11*/FDI_CHECK			( 2,13, (farStr*)MConfRemountSystem),
		/*12*/FDI_LABEL			( 2,14, (farStr*)MConfTimeout),
		/*13*/FDI_EDIT			(10,14,20, _F("fardroidTimeout")),
		/*14*/FDI_LABEL			( 2,16, (farStr*)MConfADBPath),
		/*15*/FDI_EDIT			(15,16,43, _F("fardroidADBPath")),
		/*16*/FDI_DEFCBUTTON	(18,(farStr *)MOk),
		/*17*/FDI_CBUTTON		(18,(farStr *)MCancel)
	};

	FarDialogItem DialogItems[sizeof(InitItems)/sizeof(InitItems[0])];
	InitDialogItems(InitItems,DialogItems,sizeof(InitItems)/sizeof(InitItems[0]));

	DialogItems[1].Selected = conf.AddToDiskMenu;

	wchar_t * editbuf2 = (wchar_t *)my_malloc(100);
	lstrcpyW(editbuf2, conf.Prefix);
	DialogItems[3].Data = editbuf2;

	DialogItems[4].Selected = conf.WorkMode == WORKMODE_SAFE;
	DialogItems[5].Selected = conf.WorkMode == WORKMODE_NATIVE;
	DialogItems[6].Selected = conf.WorkMode == WORKMODE_BUSYBOX;
	DialogItems[7].Selected = conf.ShowLinksAsDir;
	DialogItems[8].Selected = conf.ShowAllPartitions;
	DialogItems[9].Selected = conf.UseSU;
	DialogItems[10].Selected = conf.UseExtendedAccess;
	DialogItems[11].Selected = conf.RemountSystem;

	wchar_t * editbuf3 = (wchar_t *)my_malloc(100);
	FSF.sprintf(editbuf3, L"%d", conf.TimeOut);
	DialogItems[13].Data = editbuf3;

	wchar_t * editbuf4 = (wchar_t *)my_malloc(1024);
	lstrcpyW(editbuf4, conf.ADBPath);
	DialogItems[15].Data = editbuf4;

	HANDLE hdlg = fInfo.DialogInit(&MainGuid, &DialogGuid, -1, -1, 47, 20, _F("Config"), DialogItems, sizeof(InitItems)/sizeof(InitItems[0]), 0, 0, ConfigDlgProc, 0);
	if(conf.WorkMode != WORKMODE_BUSYBOX)
		fInfo.SendDlgMessage(hdlg, DM_ENABLE, 7, FALSE);
	if(!(conf.UseSU && conf.WorkMode == WORKMODE_NATIVE))
		fInfo.SendDlgMessage(hdlg, DM_ENABLE, 10, FALSE);
	int res = fInfo.DialogRun(hdlg);
	if (res == 16)
	{
		conf.AddToDiskMenu = GetItemSelected(hdlg, 1);

		conf.Prefix = GetItemData(hdlg, 3);
		if (GetItemSelected(hdlg, 4))
			conf.WorkMode = WORKMODE_SAFE;
		else if (GetItemSelected(hdlg, 5))
			conf.WorkMode = WORKMODE_NATIVE;
		if (GetItemSelected(hdlg, 6))
			conf.WorkMode = WORKMODE_BUSYBOX;

		conf.ShowLinksAsDir	= GetItemSelected(hdlg, 7);
		conf.ShowAllPartitions	= GetItemSelected(hdlg, 8);
		conf.UseSU = GetItemSelected(hdlg, 9);
		conf.UseExtendedAccess = GetItemSelected(hdlg, 10);
		conf.RemountSystem = GetItemSelected(hdlg, 11);

		conf.TimeOut = FSF.atoi(GetItemData(hdlg, 13));

		conf.ADBPath = GetItemData(hdlg, 15);

		conf.Save();
	}
	fInfo.DialogFree(hdlg);
	my_free(editbuf2);
	my_free(editbuf3);
	my_free(editbuf4);

	return res == 16;
}
Exemplo n.º 13
0
int WINAPI Config(void)
{
	InitDialogItem InitItems[]=
	{
		{DI_DOUBLEBOX, 3, 1,72,21, 0,0,0,0, FMSG(MConfigTitle)},
		{DI_CHECKBOX,5, 2,0,0,0, 0,0,0,  FMSG(MConfigAddToDisksMenu)},      //Add to Disks menu
		{DI_FIXEDIT,35, 2,37, 2,0,0,0,0,NULL},
		{DI_CHECKBOX,5, 3,0,0,0, 0,0,0,  FMSG(MConfigAddToPluginsMenu)},    //Add to Plugins menu
		{DI_TEXT,9, 4,0,0,0, 0,0,0,  FMSG(MHostsMode)},                 //Hosts panel mode
		{DI_FIXEDIT,5, 4, 7, 4,0,0,0,0,NULL},
		{DI_CHECKBOX,5, 5,0,0,0,  0,0,0, FMSG(MConfigReadDiz)},             //Read descriptions
		{DI_CHECKBOX,5, 6,0,0,0, 0,0,0,  FMSG(MConfigUpdateDiz)},           //Update descriptions
		{DI_CHECKBOX,5, 7,0,0,0, 0,0,0,  FMSG(MConfigUploadLowCase)},       //Upload upper in lowercase
		{DI_CHECKBOX,5, 8,0,0,0, 0,0,0,  FMSG(MConfigUploadDialog)},        //Show upload options dialog
		{DI_CHECKBOX,5, 9,0,0,0, 0,0,0,  FMSG(MConfigDefaultResume)},       //Default button is 'Resume'
		{DI_CHECKBOX,5,10,0,0,0, 0,0,0,  FMSG(MAskAbort)},                  //Confirm abort
		{DI_CHECKBOX,5,11,0,0,0, 0,0,0,  FMSG(MShowIdle)},                  //Show idle
		{DI_BUTTON,21,11,0,0,0, 0,0,0,  FMSG(MColor)},                    //Color
		{DI_RADIOBUTTON,32,11,0,0,0,0,DIF_GROUP, 0,  FMSG(MScreen)},                   //( ) 1.Screen
		{DI_RADIOBUTTON,44,11,0,0,0,  0,0,0, FMSG(MCaption)},                  //( ) 2.Caption
		{DI_RADIOBUTTON,58,11,0,0,0,  0,0,0, FMSG(MBoth)},                     //( ) 3.Both

		{DI_CHECKBOX,40, 2,0,0,0, 0,0,0,  FMSG(MKeepAlive)},                //Keepalive packet
		{DI_EDIT,67, 2,70, 2,0,0,0,0,NULL},
		{DI_TEXT,71, 2,0,0,0, 0,0,0,  FMSG(MSec)},                      //s
		{DI_CHECKBOX,40, 3,0,0,0, 0,0,0,  FMSG(MAutoRetry)},                //AutoRetry
		{DI_EDIT,67, 3,70, 3,0,0,0,0,NULL},
		{DI_CHECKBOX,40, 4,0,0,0, 0,0,0,  FMSG(MLongOp)},                   //Long operation beep
		{DI_EDIT,67, 4,70, 4,0,0,0,0,NULL},
		{DI_TEXT,71, 4,0,0,0,  0,0,0, FMSG(MSec)},                      //s
		{DI_TEXT,40, 5,0,0,0, 0,0,0,  FMSG(MWaitTimeout)},              //Server reply timeout (s)
		{DI_EDIT,67, 5,70, 5,0,0,0,0,NULL},
		{DI_CHECKBOX,40, 6,0,0,0, 0,0,0,  FMSG(MDigitDelimit)},             //Digits grouping symbol
		{DI_EDIT,69, 6,70, 6,0,0,0,0,NULL},
		{DI_CHECKBOX,40, 7,0,0,0, 0,0,0,  FMSG(MExtWindow)},                //Show FTP command log
		{DI_TEXT,40, 8,0,0,0,  0,0,0, FMSG(MExtSize)},                  //Log window size
		{DI_EDIT,60, 8,63, 8,0,0,0,0,NULL},
		{DI_TEXT,64, 8,0,0,0,0,0,0,   " x "},
		{DI_EDIT,67, 8,70, 8,0,0,0,0,NULL},
		{DI_TEXT,40, 9,0,0,0,  0,0,0, FMSG(MHostIOSize)},               //I/O buffer size
		{DI_EDIT,60, 9,70, 9,0,0,0,0,NULL},
		{DI_TEXT,40,10,0,0,0,  0,0,0, FMSG(MSilentText)},               //Alert text
		{DI_BUTTON,60,10,0,0,0,0,0,0,   FMSG(MColor)},

		{DI_TEXT,5,12,5,12,0,0,DIF_BOXCOLOR|DIF_SEPARATOR,0,NULL },

		{DI_TEXT,5,13,0,0,0, 0,0,0,  FMSG(MConfigDizNames)},            //Dis names
		{DI_EDIT,5,14,70,14,0,0,0,0,NULL},
		{DI_TEXT,5,15,0,0,0, 0,0,0,  FMSG(MConfigDefPassword)},         //Def pass
		{DI_PSWEDIT,5,16,34,16,0,0,0,0,NULL},
		{DI_TEXT,5,17,0,0,0, 0,0,0,  FMSG(MConfigFirewall)},            //Firewall
		{DI_EDIT,5,18,34,18,0,0,0,0,NULL},
		{DI_TEXT,40,15,0,0,0, 0,0,0,  FMSG(MLogFilename)},              //Log filename
		{DI_EDIT,66,15,70,15,0,0,0,0,NULL},
		{DI_TEXT,71,15,0,0,0, 0,0,0,  FMSG(MKBytes)},
		{DI_EDIT,40,16,70,16,0,0,0,0,NULL},
		{DI_CHECKBOX,40,17,0,0,0,  0,0,0, FMSG(MLogDir)},                   //Log DIR contents
		{DI_CHECKBOX,40,18,0,0,0, 0,0,0,  FMSG(MConfigPassiveMode)},
		{DI_TEXT,5,19,5,19,0,0,DIF_BOXCOLOR|DIF_SEPARATOR,0,NULL },
		{DI_BUTTON,0,20,0,0,0,0,DIF_CENTERGROUP, 1,  FMSG(MOk)},
		{DI_BUTTON,0,20,0,0,0,0,DIF_CENTERGROUP, 0,  FMSG(MCancel)},
		{DI_BUTTON,0,20,0,0,0,0,DIF_CENTERGROUP, 0,  FMSG(MExtOpt)},
	};
#define CFG_ADDDISK       1
#define CFG_DIGIT         2
#define CFG_ADDPLUGINS    3
#define CFG_HOSTMODE      5
#define CFG_READDIZ       6
#define CFG_UPDDIZ        7
#define CFG_UPCASE        8
#define CFG_SHOWUP        9
#define CFG_RESDEF        10
#define CFG_ASKABORT      11
#define CFG_SHOWIDLE      12
#define CFG_IDLECOLOR     13
#define CFG_IDLE_SCREEN   14
#define CFG_IDLE_CAPTION  15
#define CFG_IDLE_BOTH     16
#define CFG_KEEPALIVE     17
#define CFG_KEEPTIME      18
#define CFG_AUTOR         20
#define CFG_AUTORTIME     21
#define CFG_LONGOP        22
#define CFG_LONGOPTIME    23
#define CFG_WAITTIMEOUT   26
#define CFG_DIGDEL        27
#define CFG_DIGCHAR       28
#define CFG_EXT           29
#define CFG_EXT_W         31
#define CFG_EXT_H         33
#define CFG_BUFFSIZE      35
#define CFG_SILENT        37
#define CFG_DESC          40
#define CFG_PASS          42
#define CFG_FIRE          44
#define CFG_LOGLIMIT      46
#define CFG_LOGFILE       48
#define CFG_LOGDIR        49
#define CFG_PASV          50
#define CFG_OK            52
#define CFG_CANCEL        53
#define CFG_EXTBTN        54
	FarDialogItem DialogItems[ARRAYSIZE(InitItems)];
	int           IdleColor    = Opt.IdleColor,
	              ProcessColor = Opt.ProcessColor;
	int           rc;
	InitDialogItems(InitItems,DialogItems,ARRAYSIZE(DialogItems));
	DialogItems[CFG_ADDDISK].Selected = Opt.AddToDisksMenu;
	sprintf(DialogItems[CFG_DIGIT].Data,"%d",Opt.DisksMenuDigit);
	DialogItems[CFG_ADDPLUGINS].Selected  = Opt.AddToPluginsMenu;
	sprintf(DialogItems[CFG_HOSTMODE].Data,"%d",Opt.PluginColumnMode);
	DialogItems[CFG_READDIZ].Selected     = Opt.ReadDescriptions;
	DialogItems[CFG_UPDDIZ].Selected      = Opt.UpdateDescriptions;
	DialogItems[CFG_UPCASE].Selected      = Opt.UploadLowCase;
	DialogItems[CFG_SHOWUP].Selected      = Opt.ShowUploadDialog;
	DialogItems[CFG_RESDEF].Selected      = Opt.ResumeDefault;
	sprintf(DialogItems[CFG_WAITTIMEOUT].Data,"%d",Opt.WaitTimeout);
	DialogItems[CFG_SHOWIDLE].Selected    = Opt.ShowIdle;
	DialogItems[CFG_IDLE_SCREEN].Selected  = Opt.IdleMode == IDLE_CONSOLE;
	DialogItems[CFG_IDLE_CAPTION].Selected = Opt.IdleMode == IDLE_CAPTION;
	DialogItems[CFG_IDLE_BOTH].Selected    = Opt.IdleMode == (IDLE_CONSOLE|IDLE_CAPTION);
	DialogItems[CFG_KEEPALIVE].Selected   = Opt.KeepAlive != 0;
	sprintf(DialogItems[CFG_KEEPTIME].Data,"%d",Opt.KeepAlive);
	DialogItems[CFG_AUTOR].Selected       = Opt.TimeoutRetry;
	sprintf(DialogItems[CFG_AUTORTIME].Data,"%d",Opt.RetryCount);
	DialogItems[CFG_LONGOP].Selected      = Opt.LongBeepTimeout != 0;
	sprintf(DialogItems[CFG_LONGOPTIME].Data,"%d",Opt.LongBeepTimeout);
	DialogItems[CFG_ASKABORT].Selected    = Opt.AskAbort;
	DialogItems[CFG_DIGDEL].Selected      = Opt.dDelimit;
	sprintf(DialogItems[CFG_DIGCHAR].Data,"%c",Opt.dDelimiter);
	DialogItems[CFG_EXT].Selected         = Opt.ExtCmdView;
	sprintf(DialogItems[CFG_EXT_W].Data,"%d",Opt.CmdLine);
	sprintf(DialogItems[CFG_EXT_H].Data,"%d",Opt.CmdLength);
	Size2Str(DialogItems[CFG_BUFFSIZE].Data,Opt.IOBuffSize);
	strcpy(DialogItems[CFG_DESC].Data,Opt.DescriptionNames);
	strcpy(DialogItems[CFG_PASS].Data,Opt.DefaultPassword);
	strcpy(DialogItems[CFG_FIRE].Data,Opt.Firewall);
	sprintf(DialogItems[CFG_LOGLIMIT].Data,"%d",Opt.CmdLogLimit);
	sprintf(DialogItems[CFG_LOGFILE].Data,"%s",Opt.CmdLogFile);
	DialogItems[CFG_LOGDIR].Selected      = Opt.LogOutput;
	DialogItems[CFG_PASV].Selected        = Opt.PassiveMode;

	do
	{
		rc = FDialog(76,23,"Config",DialogItems,ARRAYSIZE(DialogItems));

		if(rc == CFG_OK)
			break;

		if(rc == -1 || rc == CFG_CANCEL)
			return FALSE;

		if(rc == CFG_IDLECOLOR)
			IdleColor = FP_GetColorDialog(IdleColor,&ColorLangs,NULL);
		else if(rc == CFG_SILENT)
			ProcessColor = FP_GetColorDialog(ProcessColor,&ColorLangs,NULL);
		else if(rc == CFG_EXTBTN)
			ExtendedConfig();
	}
	while(true);

//Set to OPT
	Opt.IdleColor          = IdleColor;
	Opt.ProcessColor       = ProcessColor;
	Opt.AddToDisksMenu     = DialogItems[CFG_ADDDISK].Selected;
	Opt.DisksMenuDigit     = atoi(DialogItems[CFG_DIGIT].Data);
	Opt.AddToPluginsMenu   = DialogItems[CFG_ADDPLUGINS].Selected;
	Opt.PluginColumnMode   = atoi(DialogItems[CFG_HOSTMODE].Data);
	Opt.ReadDescriptions   = DialogItems[CFG_READDIZ].Selected;
	Opt.UpdateDescriptions = DialogItems[CFG_UPDDIZ].Selected;
	Opt.UploadLowCase      = DialogItems[CFG_UPCASE].Selected;
	Opt.ShowUploadDialog   = DialogItems[CFG_SHOWUP].Selected;
	Opt.ResumeDefault      = DialogItems[CFG_RESDEF].Selected;
	Opt.WaitTimeout        = atoi(DialogItems[CFG_WAITTIMEOUT].Data);
	Opt.ShowIdle           = DialogItems[CFG_SHOWIDLE].Selected;

	if(DialogItems[CFG_IDLE_SCREEN].Selected)  Opt.IdleMode = IDLE_CONSOLE;
	else if(DialogItems[CFG_IDLE_CAPTION].Selected) Opt.IdleMode = IDLE_CAPTION;
	else
		Opt.IdleMode = IDLE_CONSOLE | IDLE_CAPTION;

	if(DialogItems[CFG_KEEPALIVE].Selected)
		Opt.KeepAlive = atoi(DialogItems[CFG_KEEPTIME].Data);
	else
		Opt.KeepAlive = 0;

	Opt.TimeoutRetry = DialogItems[CFG_AUTOR].Selected;
	Opt.RetryCount   = atoi(DialogItems[CFG_AUTORTIME].Data);

	if(DialogItems[CFG_LONGOP].Selected)
		Opt.LongBeepTimeout = atoi(DialogItems[CFG_LONGOPTIME].Data);
	else
		Opt.LongBeepTimeout = 0;

	Opt.AskAbort           = DialogItems[CFG_ASKABORT].Selected;
	Opt.dDelimit           = DialogItems[CFG_DIGDEL].Selected;
	Opt.dDelimiter         = DialogItems[CFG_DIGCHAR].Data[0];
	Opt.ExtCmdView         = DialogItems[CFG_EXT].Selected;
	Opt.CmdLine            = Max(10,Min(FP_ConWidth()-9,atoi(DialogItems[CFG_EXT_W].Data)));
	Opt.CmdLength          = Max(5,Min(FP_ConHeight()-5,atoi(DialogItems[CFG_EXT_H].Data)));
	Opt.IOBuffSize         = Max((DWORD)FTR_MINBUFFSIZE,Str2Size(DialogItems[CFG_BUFFSIZE].Data));
	strcpy(Opt.DescriptionNames,DialogItems[CFG_DESC].Data);
	strcpy(Opt.DefaultPassword,DialogItems[CFG_PASS].Data);
	strcpy(Opt.Firewall,DialogItems[CFG_FIRE].Data);
	Opt.CmdLogLimit        = atoi(DialogItems[CFG_LOGLIMIT].Data);
	strcpy(Opt.CmdLogFile, DialogItems[CFG_LOGFILE].Data);
	Opt.LogOutput          = DialogItems[CFG_LOGDIR].Selected;
	Opt.PassiveMode        = DialogItems[CFG_PASV].Selected;
//Write to REG
	WriteCfg();

	if(FTPPanels[0]) FTPPanels[0]->Invalidate();

	if(FTPPanels[1]) FTPPanels[1]->Invalidate();

	return TRUE;
}
Exemplo n.º 14
0
int WINAPI FP_GetColorDialog(int color,FLngColorDialog* p,LPCSTR Help)
{
	InitDialogItem InitItems[]=
	{
		{DI_DOUBLEBOX,3, 1,35,13,0,0,DIF_BOXCOLOR, 0,NULL},
		{DI_SINGLEBOX,5, 2,18, 7,0,0,DIF_BOXCOLOR|DIF_LEFTTEXT,0, NULL},
		{DI_RADIOBUTTON,6,3,0,0,0,0,DIF_GROUP|DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~0)&0x7, 0)),0,NULL},
		{DI_RADIOBUTTON,6,4,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~1)&0x7, 1)),0,NULL},
		{DI_RADIOBUTTON,6,5,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~2)&0x7, 2)),0,NULL},
		{DI_RADIOBUTTON,6,6,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~3)&0x7, 3)),0,NULL},
		{DI_RADIOBUTTON,9,3,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~4)&0x7, 4)),0,NULL},
		{DI_RADIOBUTTON,9,4,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~5)&0x7, 5)),0,NULL},
		{DI_RADIOBUTTON,9,5,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~6)&0x7, 6)),0,NULL},
		{DI_RADIOBUTTON,9,6,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~7)&0x7, 7)),0,NULL},
		{DI_RADIOBUTTON,12,3,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~8)&0x7, 8)),0,NULL},
		{DI_RADIOBUTTON,12,4,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~9)&0x7, 9)),0,NULL},
		{DI_RADIOBUTTON,12,5,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~10)&0x7,10)),0,NULL},
		{DI_RADIOBUTTON,12,6,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~11)&0x7,11)),0,NULL},
		{DI_RADIOBUTTON,15,3,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~12)&0x7,12)),0,NULL},
		{DI_RADIOBUTTON,15,4,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~13)&0x7,13)),0,NULL},
		{DI_RADIOBUTTON,15,5,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~14)&0x7,14)),0,NULL},
		{DI_RADIOBUTTON,15,6,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~15)&0x7,15)),0,NULL},
		{DI_SINGLEBOX,20, 2,33, 7,0,0,DIF_BOXCOLOR|DIF_LEFTTEXT, 0,NULL},
		{DI_RADIOBUTTON,21,3,0,0,0,0,DIF_GROUP|DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~0)&0x7, 0)),0,NULL},
		{DI_RADIOBUTTON,21,4,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~1)&0x7, 1)),0,NULL},
		{DI_RADIOBUTTON,21,5,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~2)&0x7, 2)),0,NULL},
		{DI_RADIOBUTTON,21,6,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~3)&0x7, 3)),0,NULL},
		{DI_RADIOBUTTON,24,3,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~4)&0x7, 4)),0,NULL},
		{DI_RADIOBUTTON,24,4,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~5)&0x7, 5)),0,NULL},
		{DI_RADIOBUTTON,24,5,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~6)&0x7, 6)),0,NULL},
		{DI_RADIOBUTTON,24,6,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~7)&0x7, 7)),0,NULL},
		{DI_RADIOBUTTON,27,3,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~8)&0x7, 8)),0,NULL},
		{DI_RADIOBUTTON,27,4,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~9)&0x7, 9)),0,NULL},
		{DI_RADIOBUTTON,27,5,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~10)&0x7,10)),0,NULL},
		{DI_RADIOBUTTON,27,6,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~11)&0x7,11)),0,NULL},
		{DI_RADIOBUTTON,30,3,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~12)&0x7,12)),0,NULL},
		{DI_RADIOBUTTON,30,4,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~13)&0x7,13)),0,NULL},
		{DI_RADIOBUTTON,30,5,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~14)&0x7,14)),0,NULL},
		{DI_RADIOBUTTON,30,6,0,0,0,0,DIF_MOVESELECT|DIF_SETCOLOR|(FAR_COLOR((~15)&0x7,15)),0,NULL},
		{DI_TEXT,5, 8,0,0,0,0,DIF_SETCOLOR|FAR_COLOR(fccYELLOW,fccGREEN), 0,NULL},
		{DI_TEXT,5, 9,0,0,0,0,DIF_SETCOLOR|FAR_COLOR(fccYELLOW,fccGREEN), 0,NULL},
		{DI_TEXT,5,10,0,0,0,0,DIF_SETCOLOR|FAR_COLOR(fccYELLOW,fccGREEN), 0,NULL},
		{DI_TEXT,3,11,3,11,0,0,DIF_BOXCOLOR|DIF_SEPARATOR,0,NULL },
		{DI_BUTTON,0,12,0,0,0,0,DIF_CENTERGROUP, 1, NULL},
		{DI_BUTTON,0,12,0,0,0,0,DIF_CENTERGROUP, 0,NULL},
	};
	FarDialogItem DialogItems[ARRAYSIZE(InitItems)];
	static FLngColorDialog base =
	{
		FMSG("Color"),
		FMSG("&Foreground"),
		FMSG("&Background"),
		FMSG("&Set"),
		FMSG("&Cancel"),
		FMSG("Text Text Text Text Text Text")
	};

	if(!p) p = &base;

	char str[FAR_MAX_CAPTION+50];
	int  n;
	InitDialogItems(InitItems,DialogItems,ARRAYSIZE(DialogItems));
	StrCpy(DialogItems[ 0].Data,         FP_GetMsg(p->MTitle?p->MTitle:base.MTitle),    FAR_MAX_CAPTION);
	StrCpy(DialogItems[ 1].Data,         FP_GetMsg(p->MFore?p->MFore:base.MFore),       FAR_MAX_CAPTION);
	StrCpy(DialogItems[18].Data,         FP_GetMsg(p->MBk?p->MBk:base.MBk),             FAR_MAX_CAPTION);
	StrCpy(DialogItems[39].Data,         FP_GetMsg(p->MSet?p->MSet:base.MSet),          FAR_MAX_CAPTION);
	StrCpy(DialogItems[40].Data,         FP_GetMsg(p->MCancel?p->MCancel:base.MCancel), FAR_MAX_CAPTION);
	StrCpy(DialogItems[cdlgTEXT].Data,   FP_GetMsg(p->MText?p->MText:base.MText),       FAR_MAX_CAPTION);
	strcpy(DialogItems[cdlgTEXT+1].Data, DialogItems[cdlgTEXT].Data);
	strcpy(DialogItems[cdlgTEXT+2].Data, DialogItems[cdlgTEXT].Data);
	ColorFore = FAR_COLOR_FORE(color);
	ColorBk   = FAR_COLOR_BK(color);

	for(n = 0; n < 16; n++)
	{
		DialogItems[cdlgFORE+n].Selected = FALSE;
		DialogItems[cdlgBK+n].Selected   = FALSE;
		DialogItems[cdlgFORE+n].Focus    = FALSE;
		DialogItems[cdlgBK+n].Focus      = FALSE;
	}

	DialogItems[ cdlgFORE+ColorFore ].Selected = TRUE;
	DialogItems[ cdlgFORE+ColorFore ].Focus = TRUE;
	DialogItems[ cdlgBK+ColorBk ].Selected     = TRUE;
	StrCpy(Title,DialogItems[0].Data,ARRAYSIZE(Title));
	sprintf(str,"(%3d 0x%02X %03o)",
	        FAR_COLOR(ColorFore,ColorBk),
	        FAR_COLOR(ColorFore,ColorBk),
	        FAR_COLOR(ColorFore,ColorBk));
	StrCat(DialogItems[0].Data,str,512);
	n = FP_Info->DialogEx(FP_Info->ModuleNumber,-1,-1,39,15,Help,DialogItems,ARRAYSIZE(DialogItems),0,0,CDLG_WndProc,0);

	if(n == cdlgOK)
		color = FAR_COLOR(ColorFore,ColorBk);

	StrCpy(DialogItems[0].Data,Title,FAR_MAX_CAPTION);
	return color;
}
Exemplo n.º 15
0
//------------------------------------------------------------------------
void ExtendedConfig(void)
{
	InitDialogItem InitItems[]=
	{
		{DI_DOUBLEBOX, 3, 1,72,17, 0,0,0,0, FMSG(METitle)},
		{DI_CHECKBOX,5, 2,0,0,0,  0,0,0,  FMSG(MDupFF)},
		{DI_CHECKBOX,5, 3,0,0,0,  0,0,0,  FMSG(MUndupFF)},
		{DI_CHECKBOX,5, 4,0,0,0,  0,0,0,  FMSG(MEShowProgress)},
		{DI_CHECKBOX,5, 5,0,0,0,  0,0,0,  FMSG(MEBackup)},
		{DI_CHECKBOX,5, 6,0,0,0,  0,0,0,  FMSG(MESendCmd)},
		{DI_CHECKBOX,5, 7,0,0,0,  0,0,0,  FMSG(MEDontError)},
		{DI_CHECKBOX,5, 8,0,0,0,  0,0,0,  FMSG(MEAskLoginAtFail)},
		{DI_CHECKBOX,5, 9,0,0,0,  0,0,0,  FMSG(MEAutoAn)},
		{DI_CHECKBOX,5,10,0,0,0,  0,0,0,  FMSG(MECloseDots)},
		{DI_CHECKBOX,5,11,0,0,0,  0,0,0,  FMSG(MQuoteClipboardNames)},
		{DI_CHECKBOX,5,12,0,0,0,   0,0,0, FMSG(MSetHiddenOnAbort)},

		{DI_TEXT,3,15,3,15,0,0,DIF_BOXCOLOR|DIF_SEPARATOR,0,NULL },

		{DI_BUTTON,0,16,0,0,0,0,DIF_CENTERGROUP, 1,   FMSG(MOk)},
		{DI_BUTTON,0,16,0,0,0,0,DIF_CENTERGROUP, 0,   FMSG(MCancel)},
	};
	enum
	{
		dDupFF        = 1,
		dUndupFF      = 2,
		dShowProgress = 3,
		dBackup       = 4,
		dSendCmd      = 5,
		dDontErr      = 6,
		dAskFail      = 7,
		dAutoAnn      = 8,
		dCloseDots    = 9,
		dQuoteCN      = 10,
		dSetHiddenOnAbort = 11,

		dOk           = 13
	};
	int           rc;
	FarDialogItem DialogItems[ARRAYSIZE(InitItems)];
	InitDialogItems(InitItems,DialogItems,ARRAYSIZE(DialogItems));
	DialogItems[dDupFF].Selected        = Opt.FFDup;
	DialogItems[dUndupFF].Selected      = Opt.UndupFF;
	DialogItems[dShowProgress].Selected = Opt.ShowSilentProgress;
	DialogItems[dBackup].Selected       = Opt.UseBackups;
	DialogItems[dSendCmd].Selected      = Opt.ProcessCmd;
	DialogItems[dDontErr].Selected      = Opt.DoNotExpandErrors;
	DialogItems[dAskFail].Selected      = Opt.AskLoginFail;
	DialogItems[dAutoAnn].Selected      = Opt.AutoAnonymous;
	DialogItems[dCloseDots].Selected    = Opt.CloseDots;
	DialogItems[dQuoteCN].Selected      = Opt.QuoteClipboardNames;
	DialogItems[dSetHiddenOnAbort].Selected  = Opt.SetHiddenOnAbort;

	do
	{
		rc = FDialog(76,19,"FTPExtGlobal",DialogItems,ARRAYSIZE(DialogItems));

		if(rc == -1)
			return;

		if(rc != dOk)
			return;

		break;
	}
	while(true);

	Opt.FFDup              = DialogItems[dDupFF].Selected;
	Opt.UndupFF            = DialogItems[dUndupFF].Selected;
	Opt.ShowSilentProgress = DialogItems[dShowProgress].Selected;
	Opt.UseBackups         = DialogItems[dBackup].Selected;
	Opt.ProcessCmd         = DialogItems[dSendCmd].Selected;
	Opt.DoNotExpandErrors  = DialogItems[dDontErr].Selected;
	Opt.AskLoginFail       = DialogItems[dAskFail].Selected;
	Opt.AutoAnonymous      = DialogItems[dAutoAnn].Selected;
	Opt.CloseDots          = DialogItems[dCloseDots].Selected;
	Opt.QuoteClipboardNames= DialogItems[dQuoteCN].Selected;
	Opt.SetHiddenOnAbort   = DialogItems[dSetHiddenOnAbort].Selected;
}