static void dlgDataToGlobal( dlg_data *data ) { LangInit( data->Language ); EditFlags.PPKeywordOnly = data->PPKeywordOnly; EditFlags.CMode = data->CMode; EditFlags.ReadEntireFile = data->ReadEntireFile; EditFlags.ReadOnlyCheck = data->ReadOnlyCheck; EditFlags.IgnoreCtrlZ = data->IgnoreCtrlZ; EditFlags.CRLFAutoDetect = data->CRLFAutoDetect; EditFlags.WriteCRLF = data->WriteCRLF; EditFlags.EightBits = data->EightBits; EditFlags.RealTabs = data->RealTabs; EditFlags.AutoIndent = data->AutoIndent; EditFlags.IgnoreTagCase = data->IgnoreTagCase; EditFlags.TagPrompt = data->TagPrompt; EditFlags.ShowMatch = data->ShowMatch; EditVars.TabAmount = data->TabAmount; EditVars.HardTab = data->HardTab; EditVars.ShiftWidth = data->ShiftWidth; /* * language specific variables with extra handling */ if( strcmp( EditVars.TagFileName, data->TagFileName ) ) { AddString2( &EditVars.TagFileName, data->TagFileName ); } if( strcmp( EditVars.GrepDefault, data->GrepDefault ) ) { AddString2( &EditVars.GrepDefault, data->GrepDefault ); } }
bool LangSetInit( void ) { static char InitialLang[] = { "cpp" }; LangInit(); _Alloc( Language, sizeof( InitialLang ) + 1 ); if( Language == NULL ) return( FALSE ); StrCopy( InitialLang, Language ); return( LangLoad( Language, strlen( Language ) ) ); }
int main(int argc, char **argv) { int ch, i, loop; struct utsname ubuf; const char *str, *dstr; /* This function runs all the setup for startup, and then * proceeds into the primary event loop at the end. */ /* Init state variable struct */ memset(&Mode, 0, sizeof(EMode)); Mode.wm.master = 1; Mode.wm.pid = getpid(); Mode.wm.exec_name = argv[0]; Mode.wm.startup = 1; Mode.mode = MODE_NONE; EXInit(); Dpy.screen = -1; str = getenv("EDEBUG"); if (str) EDebugInit(str); str = getenv("EDEBUG_COREDUMP"); if (str) Mode.wm.coredump = 1; str = getenv("EDEBUG_EXIT"); if (str) Mode.debug_exit = atoi(str); str = getenv("ECONFNAME"); if (str) EConfNameSet(str); str = getenv("ECONFDIR"); if (str) EDirUserSet(str); str = getenv("ECACHEDIR"); if (str) EDirUserCacheSet(str); srand((unsigned int)time(NULL)); if (!uname(&ubuf)) Mode.wm.machine_name = Estrdup(ubuf.nodename); if (!Mode.wm.machine_name) Mode.wm.machine_name = Estrdup("localhost"); /* Now we're going to interpret any of the commandline parameters * that are passed to it -- Well, at least the ones that we * understand. */ Mode.theme.path = NULL; dstr = NULL; for (loop = 1; loop;) { ch = EoptGet(argc, argv); if (ch <= 0) break; #if 0 Eprintf("Opt: %c: %d - %s\n", ch, eoptind, eoptarg); #endif switch (ch) { default: case '?': printf("e16: Ignoring: "); for (i = eoptind; i < argc; i++) printf("%s ", argv[i]); printf("\n"); loop = 0; break; case 'h': EoptHelp(); exit(0); break; case 'd': dstr = eoptarg; break; case 'f': Mode.wm.restart = 1; break; case 'p': EConfNameSet(eoptarg); break; case 'P': EDirUserSet(eoptarg); break; case 'Q': EDirUserCacheSet(eoptarg); break; case 's': Mode.wm.single = 1; Dpy.screen = strtoul(eoptarg, NULL, 10); break; case 'S': SetSMID(eoptarg); break; case 't': Mode.theme.path = Estrdup(eoptarg); break; case 'V': printf("%s %s\n", e_wm_name, e_wm_version); exit(0); break; case 'v': EDebugSet(EDBUG_TYPE_VERBOSE, 1); break; case 'w': sscanf(eoptarg, "%dx%d", &Mode.wm.win_w, &Mode.wm.win_h); Mode.wm.window = 1; Mode.wm.single = 1; Mode.wm.master = 0; break; #ifdef USE_EXT_INIT_WIN case 'X': ExtInitWinSet(strtoul(eoptarg, NULL, 0)); Mode.wm.restart = 1; break; #endif case 'm': Mode.wm.master = 0; Mode.wm.master_screen = strtoul(eoptarg, NULL, 10); break; } } SignalsSetup(); /* Install signal handlers */ EDirsSetup(); ECheckEprog("epp"); ECheckEprog("eesh"); SetupX(dstr); /* This is where the we fork per screen */ /* X is now running, and we have forked per screen */ ESavePrefixSetup(); /* So far nothing should rely on a selected settings or theme. */ ConfigurationLoad(); /* Load settings */ /* Initialise internationalisation */ LangInit(); /* The theme path must now be available for config file loading. */ ThemePathFind(); /* Set the Environment variables */ Esetenv("EVERSION", e_wm_version); Esetenv("EROOT", EDirRoot()); Esetenv("EBIN", EDirBin()); Esetenv("ECONFDIR", EDirUser()); Esetenv("ECACHEDIR", EDirUserCache()); Esetenv("ETHEME", Mode.theme.path); /* Move elsewhere? */ EImageInit(); HintsInit(); CommsInit(); SessionInit(); SnapshotsLoad(); #if USE_DBUS DbusInit(); #endif if (Mode.wm.window) EMapWindow(VROOT); ModulesSignal(ESIGNAL_INIT, NULL); /* Load the theme */ ThemeConfigLoad(); if (Mode.debug_exit) return 0; /* Do initial configuration */ ModulesSignal(ESIGNAL_CONFIGURE, NULL); /* Set root window cursor */ ECsrApply(ECSR_ROOT, WinGetXwin(VROOT)); #ifdef USE_EXT_INIT_WIN /* Kill the E process owning the "init window" */ ExtInitWinKill(); #endif /* let's make sure we set this up and go to our desk anyways */ DeskGoto(DesksGetCurrent()); ESync(ESYNC_MAIN); #ifdef SIGCONT for (i = 0; i < Mode.wm.child_count; i++) kill(Mode.wm.children[i], SIGCONT); #endif ModulesSignal(ESIGNAL_START, NULL); #if ENABLE_DIALOGS DialogsInit(); #endif EwinsManage(); RunInitPrograms(); SnapshotsSpawn(); if (!Mode.wm.restart) StartupWindowsOpen(); Conf.startup.firsttime = 0; Mode.wm.save_ok = Conf.autosave; Mode.wm.startup = 0; autosave(); /* The primary event loop */ EventsMain(); SessionExit(EEXIT_QUIT, NULL); return 0; }
/* * createNewFile - create new file entry */ static vi_rc createNewFile( char *name, bool same_file ) { int height; window_id cw; info *tmp; vi_rc rc; /* * test that we can create this file */ tmp = NULL; if( !same_file ) { rc = FileExists( name ); if( !(rc == ERR_READ_ONLY_FILE || rc == ERR_NO_ERR || rc == ERR_FILE_EXISTS) ) { return( rc ); } } else { if( name != NULL ) { for( tmp = InfoHead; tmp != NULL; tmp = tmp->next ) { if( !strcmp( tmp->CurrentFile->name, name ) ) { break; } } } if( tmp == NULL ) { return( ERR_FILE_NOT_FOUND ); } if( tmp->CurrentFile->dup_count > MAX_DUPLICATE_FILES ) { return( ERR_WIND_NO_MORE_WINDOWS ); } } /* * get new window */ rc = NewWindow2( &cw, &editw_info ); if( rc != ERR_NO_ERR ) { return( rc ); } #ifdef __WIN__ if( !strncmp( name, "untitled", 8 ) ) { // better yet, pass normal/maximize flag to NewWindow2... ShowWindow( cw, SW_SHOWMAXIMIZED ); } #endif SetBorderGadgets( cw, EditFlags.WindowGadgets ); /* * get new file entry, and read the data */ if( same_file ) { CurrentFile = tmp->CurrentFile; CurrentFile->dup_count++; SetFileWindowTitle( CurrentWindow, CurrentInfo, true ); tmp = CurrentInfo; CurrentInfo = MemAlloc( sizeof( *CurrentInfo ) ); FTSRunCmds( name ); rc = ERR_NO_ERR; } else { bool crlf_reached; crlf_reached = false; tmp = CurrentInfo; CurrentInfo = MemAlloc( sizeof( *CurrentInfo ) ); FTSRunCmds( name ); height = editw_info.y2 - editw_info.y1 + 1; CurrentFile = FileAlloc( name ); rc = OpenFcbData( CurrentFile ); for( ; rc == ERR_NO_ERR; ) { rc = ReadFcbData( CurrentFile, &crlf_reached ); if( rc == ERR_NO_ERR && !CurrentFile->is_stdio ) { if( EditFlags.BreakPressed || !EditFlags.ReadEntireFile ) { if( CurrentFile->fcbs.tail->end_line > height ) { break; } } } } if( rc != ERR_NO_ERR && rc != ERR_FILE_NOT_FOUND && rc != END_OF_FILE ) { MemFree( CurrentInfo ); CurrentInfo = tmp; FileFree( CurrentFile ); CloseAWindow( cw ); return( rc ); } if( rc == ERR_FILE_NOT_FOUND ) { rc = NEW_FILE; EditFlags.NewFile = true; CurrentFile->write_crlf = FileSysNeedsCR( CurrentFile->handle ); #ifdef __UNIX__ CurrentFile->attr = PMODE_RW; #endif } else { rc = ERR_NO_ERR; CurrentFile->write_crlf = crlf_reached; EditFlags.NewFile = false; #ifdef __UNIX__ { struct stat sb; stat( name, &sb ); CurrentFile->attr = sb.st_mode & ~S_IFMT; } #endif } CurrentFile->check_readonly = true; } /* * create info entry */ CurrentPos.line = 0; CurrentPos.column = 1; VirtualColumnDesired = 1; LeftTopPos.line = 1; LeftTopPos.column = 0; if( !same_file ) { AllocateUndoStacks(); } AllocateMarkList(); CurrentWindow = cw; CurrentInfo->DuplicateID = CurrentFile->dup_count; CurrentInfo->CurrentWindow = cw; LangInit( CurrentInfo->fsi.Language ); #ifdef __WIN__ { window_data *wd; wd = DATA_FROM_ID( cw ); wd->info = CurrentInfo; } #endif DCCreate(); SetFileWindowTitle( CurrentWindow, CurrentInfo, true ); /* * set current file info */ CurrentFcb = CurrentFile->fcbs.head; CurrentLine = CurrentFcb->lines.head; if( EditFlags.LineNumbers ) { LineNumbersSetup(); } if( tmp != NULL ) { InsertLLItemAfter( (ss **)&InfoTail, (ss *)tmp, (ss *)CurrentInfo ); } else { AddLLItemAtEnd( (ss **)&InfoHead, (ss **)&InfoTail, (ss *)CurrentInfo ); } return( rc ); } /* createNewFile */
/* * processSetToken - set value for set token */ static vi_rc processSetToken( int j, char *value, int *winflag, bool isnonbool ) { char fn[MAX_STR], str[MAX_STR]; #ifndef VICOMP char tmp[3]; char settokstr[TOK_MAX_LEN + 1]; char save[MAX_STR]; vi_rc rc = ERR_NO_ERR; int i, clr, k; bool newset; bool set1, toggle, *ptr; jmp_buf jmpaddr; cursor_type ct; char *name; command_rtn fptr; event_bits eb; bool redisplay = FALSE; #endif bool bvalue; #ifdef VICOMP winflag = winflag; isnonbool = isnonbool; #endif /* * set up value for boolean set commands */ if( j < 0 ) { j *= -1; bvalue = FALSE; } else { bvalue = TRUE; } #ifndef VICOMP if( !(*winflag) ) { toggle = TRUE; set1 = isnonbool; } else { toggle = FALSE; #endif if( j >= SET1_T_ ) { #ifndef VICOMP if( EditFlags.CompileScript ) { #endif if( !bvalue ) { j *= -1; } itoa( j, str, 10 ); StrMerge( 2, WorkLine->data, str, SingleBlank ); return( ERR_NO_ERR ); #ifndef VICOMP } set1 = FALSE; j -= SET1_T_; } else { set1 = TRUE; #endif } #ifndef VICOMP } *winflag = FALSE; /* * process boolean settings */ if( !set1 ) { if( j >= SET2_T_ ) { return( ERR_INVALID_SET_COMMAND ); } ptr = &(((bool *)&EditFlags)[j]); newset = bvalue; if( toggle ) { newset = !(*ptr); } switch( j ) { case SET2_T_MODELESS: if( (newset && !EditFlags.Modeless) || (!newset && EditFlags.Modeless) ) { for( k = 0; k < MAX_EVENTS; k++ ) { fptr = EventList[k].rtn; eb = EventList[k].b; EventList[k].rtn = EventList[k].alt_rtn; EventList[k].alt_rtn = fptr; EventList[k].b = EventList[k].alt_b; EventList[k].alt_b = eb; } if( !EditFlags.Modeless ) { if( MenuWindow != NO_WINDOW ) { UpdateCurrentStatus( CSTATUS_INSERT ); } EditFlags.WasOverstrike = FALSE; NewCursor( CurrentWindow, EditVars.InsertCursorType ); } else { if( MenuWindow != NO_WINDOW ) { UpdateCurrentStatus( CSTATUS_COMMAND ); } NewCursor( CurrentWindow, EditVars.NormalCursorType ); // nomodeless must be line based or it dies! EditFlags.LineBased = TRUE; } /* re-position cursor in window */ SetWindowCursor(); } EditFlags.Modeless = newset; break; case SET2_T_UNDO: if( EditFlags.Undo && !newset ) { FreeAllUndos(); } EditFlags.Undo = newset; break; case SET2_T_STATUSINFO: EditFlags.StatusInfo = newset; #ifdef __WIN__ ResizeRoot(); #endif rc = NewStatusWindow(); break; case SET2_T_WINDOWGADGETS: EditFlags.WindowGadgets = newset; ResetAllWindows(); *winflag = TRUE; redisplay = TRUE; break; case SET2_T_REALTABS: EditFlags.RealTabs = newset; redisplay = TRUE; break; case SET2_T_CLOCK: EditFlags.Clock = newset; redisplay = TRUE; break; case SET2_T_TOOLBAR: EditFlags.Toolbar = newset; #ifdef __WIN__ ResizeRoot(); #endif break; case SET2_T_COLORBAR: EditFlags.Colorbar = newset; #ifdef __WIN__ if( Root == NULL ) { EditFlags.Colorbar = FALSE; } else { RefreshColorbar(); } #endif break; case SET2_T_SSBAR: EditFlags.SSbar = newset; #ifdef __WIN__ if( Root == NULL ) { EditFlags.SSbar = FALSE; } else { RefreshSSbar(); } #endif break; case SET2_T_FONTBAR: EditFlags.Fontbar = newset; #ifdef __WIN__ if( Root == NULL ) { EditFlags.Fontbar = FALSE; } else { RefreshFontbar(); } #endif break; case SET2_T_MARKLONGLINES: EditFlags.MarkLongLines = newset; break; case SET2_T_MENUS: EditFlags.Menus = newset; InitMenu(); break; case SET2_T_LINENUMBERS: if( toggle ) { newset = !EditFlags.LineNumbers; } if( newset != EditFlags.LineNumbers ) { EditFlags.LineNumbers = newset; rc = LineNumbersSetup(); *winflag = TRUE; } break; case SET2_T_CURRENTSTATUS: EditFlags.CurrentStatus = newset; InitMenu(); break; case SET2_T_DISPLAYSECONDS: EditFlags.DisplaySeconds = newset; redisplay = TRUE; break; case SET2_T_PPKEYWORDONLY: EditFlags.PPKeywordOnly = newset; redisplay = TRUE; break; case SET2_T_LASTEOL: #ifndef __WIN__ *ptr = TRUE; toggle = FALSE; break; #endif default: *ptr = newset; break; } if( msgFlag ) { if( !newset ) { tmp[0] = 'n'; tmp[1] = 'o'; tmp[2] = 0; } else { tmp[0] = 0; } MySprintf( fn, "%s%s set", tmp, GetTokenStringCVT( SetTokens2, j, settokstr, TRUE ) ); } if( toggle ) { strcpy( save, BoolStr[(int) newset] ); (*winflag) += 1; } /* * process value settings */ } else { if( toggle ) { rc = GetNewValueDialog( value ); if( rc != ERR_NO_ERR ) { return( rc ); } strcpy( save, value ); } #endif /* VICOMP */ RemoveLeadingSpaces( value ); if( value[0] == '"' ) { NextWord( value, fn, "\"" ); EliminateFirstN( value, 1 ); } else { NextWord1( value, fn ); } #ifndef VICOMP if( EditFlags.CompileScript ) { #endif itoa( j, str, 10 ); strcat( WorkLine->data, str ); if( fn[0] == '\0' ) return( ERR_NO_ERR ); switch( j ) { case SET1_T_STATUSSTRING: case SET1_T_FILEENDSTRING: case SET1_T_HISTORYFILE: case SET1_T_TMPDIR: case SET1_T_TAGFILENAME: StrMerge( 4, WorkLine->data, SingleBlank, SingleQuote, fn, SingleQuote ); break; case SET1_T_COMMANDCURSORTYPE: case SET1_T_OVERSTRIKECURSORTYPE: case SET1_T_INSERTCURSORTYPE: StrMerge( 2, WorkLine->data, SingleBlank, fn ); if( NextWord1( value, fn ) <= 0 ) { break; } StrMerge( 2, WorkLine->data, SingleBlank, fn ); break; case SET1_T_TILECOLOR: StrMerge( 2, WorkLine->data, SingleBlank, fn ); if( NextWord1( value, fn ) <= 0 ) { return( ERR_INVALID_SET_COMMAND ); } if( NextWord1( value, str ) <= 0 ) { return( ERR_INVALID_SET_COMMAND ); } StrMerge( 4, WorkLine->data, fn, SingleBlank, str, SingleBlank ); break; case SET1_T_STATUSSECTIONS: StrMerge( 2, WorkLine->data, SingleBlank, fn ); while( NextWord1( value, fn ) > 0 ) { #ifdef VICOMP int k; #endif k = atoi( fn ); if( k <= 0 ) { break; } StrMerge( 2, WorkLine->data, SingleBlank, fn ); } break; default: StrMerge( 2, WorkLine->data, SingleBlank, fn ); break; } return( ERR_NO_ERR ); #ifndef VICOMP } switch( j ) { case SET1_T_STATUSSECTIONS: if( EditVars.StatusSections != NULL ) { MemFree( EditVars.StatusSections ); EditVars.StatusSections = NULL; EditVars.NumStatusSections = 0; } for( ;; ) { k = atoi( fn ); if( k <= 0 ) { break; } EditVars.StatusSections = MemReAlloc( EditVars.StatusSections, sizeof( short ) * (EditVars.NumStatusSections + 1) ); EditVars.StatusSections[EditVars.NumStatusSections] = k; EditVars.NumStatusSections++; if( NextWord1( value, fn ) <= 0 ) { break; } } if( EditVars.StatusSections == NULL ) { MySprintf( fn, "statussections turned off" ); } else { MySprintf( fn, "statussections set" ); } break; case SET1_T_FILEENDSTRING: AddString2( &EditVars.FileEndString, fn ); ResetAllWindows(); redisplay = TRUE; break; case SET1_T_STATUSSTRING: AddString2( &EditVars.StatusString, fn ); if( StatusWindow != NO_WINDOW ) { ClearWindow( StatusWindow ); UpdateStatusWindow(); } if( msgFlag ) { MySprintf( fn, "statusstring set to %s", EditVars.StatusString ); } break; case SET1_T_GREPDEFAULT: AddString2( &EditVars.GrepDefault, fn ); break; case SET1_T_TILECOLOR: if( EditVars.TileColors == NULL ) { EditVars.TileColors = (type_style *) MemAlloc( sizeof( type_style ) * ( EditVars.MaxTileColors + 1 ) ); for( i = 0; i <= EditVars.MaxTileColors; ++i ) { EditVars.TileColors[i].foreground = -1; EditVars.TileColors[i].background = -1; EditVars.TileColors[i].font = -1; } } clr = atoi( fn ); if( clr > EditVars.MaxTileColors ) { return( ERR_INVALID_SET_COMMAND ); } if( NextWord1( value, fn ) <= 0 ) { return( ERR_INVALID_SET_COMMAND ); } EditVars.TileColors[clr].foreground = atoi( fn ); if( NextWord1( value, fn ) <= 0 ) { return( ERR_INVALID_SET_COMMAND ); } EditVars.TileColors[clr].background = atoi( fn ); EditVars.TileColors[clr].font = FONT_DEFAULT; if( msgFlag ) { MySprintf( fn, "tilecolor %d set", clr ); } break; case SET1_T_GADGETSTRING: SetGadgetString( fn ); if( msgFlag ) { MySprintf( fn, "gadget string set to %s", EditVars.GadgetString ); } ResetAllWindows(); break; case SET1_T_SHELLPROMPT: AddString2( &EditVars.SpawnPrompt, fn ); if( msgFlag ) { MySprintf( fn, "prompt string set to %s", EditVars.SpawnPrompt ); } break; case SET1_T_FIGNORE: if( fn[0] == 0 ) { MemFreePtr( (void **)&EditVars.FIgnore ); EditVars.CurrFIgnore = 0; if( msgFlag ) { MySprintf( fn, "fignore reset" ); } } else { EditVars.FIgnore = MemReAlloc( EditVars.FIgnore, EXTENSION_LENGTH * (EditVars.CurrFIgnore + 1) ); str[0] = '.'; str[1] = 0; strcat( str, fn ); str[EXTENSION_LENGTH - 1] = 0; strcpy( &EditVars.FIgnore[EXTENSION_LENGTH * EditVars.CurrFIgnore], str ); EditVars.CurrFIgnore++; if( msgFlag ) { MySprintf( fn, "%s added to fignore", str ); } } break; case SET1_T_HISTORYFILE: AddString2( &EditVars.HistoryFile, fn ); if( msgFlag ) { MySprintf( fn, "history file set to %s", EditVars.HistoryFile ); } break; case SET1_T_TAGFILENAME: AddString2( &EditVars.TagFileName, fn ); if( msgFlag ) { MySprintf( fn, "tag file name set to %s", EditVars.TagFileName ); } break; case SET1_T_FILENAME: if( CurrentFile != NULL ) { AddString2( &(CurrentFile->name), fn ); SetFileWindowTitle( CurrentWindow, CurrentInfo, TRUE ); if( msgFlag ) { MySprintf( fn, "filename set to %s", CurrentFile->name ); } FileSPVAR(); } break; case SET1_T_TMPDIR: AddString2( &EditVars.TmpDir, fn ); VerifyTmpDir(); if( msgFlag ) { MySprintf( fn, "tmpdir set to %s", EditVars.TmpDir ); } break; case SET1_T_WORD: AddString2( &EditVars.WordDefn, fn ); InitWordSearch( EditVars.WordDefn ); if( msgFlag ) { MySprintf( fn, "word set to %s", EditVars.WordDefn ); } break; case SET1_T_WORDALT: AddString2( &EditVars.WordAltDefn, fn ); if( msgFlag ) { MySprintf( fn, "wordalt set to %s", EditVars.WordAltDefn ); } break; case SET1_T_MAGICSTRING: AddString2( &EditVars.Majick, fn ); if( msgFlag ) { MySprintf( fn, "magicstring set to %s", EditVars.Majick ); } break; case SET1_T_COMMANDCURSORTYPE: case SET1_T_OVERSTRIKECURSORTYPE: case SET1_T_INSERTCURSORTYPE: i = setjmp( jmpaddr ); if( i != 0 ) { return( ERR_INVALID_SET_COMMAND ); } StartExprParse( fn, jmpaddr ); ct.height = GetConstExpr(); if( NextWord1( value, fn ) <= 0 ) { ct.width = 100; } else { i = setjmp( jmpaddr ); if( i != 0 ) { return( ERR_INVALID_SET_COMMAND ); } StartExprParse( fn, jmpaddr ); ct.width = GetConstExpr(); } if( j == SET1_T_COMMANDCURSORTYPE ) { EditVars.NormalCursorType = ct; name = "command"; } else if( j == SET1_T_OVERSTRIKECURSORTYPE ) { EditVars.OverstrikeCursorType = ct; name = "overstrike"; } else { EditVars.InsertCursorType = ct; name = "insert"; } if( msgFlag ) { MySprintf( fn, "%s cursor type set to %d,%d", name, ct.height, ct.width ); } break; default: i = setjmp( jmpaddr ); if( i != 0 ) { return( ERR_INVALID_SET_COMMAND ); } StartExprParse( fn, jmpaddr ); i = GetConstExpr(); if( i < 0 ) { i = 0; } switch( j ) { case SET1_T_WRAPMARGIN: EditVars.WrapMargin = i; break; case SET1_T_CURSORBLINKRATE: SetCursorBlinkRate( i ); break; case SET1_T_MAXPUSH: EditVars.MaxPush = i; if( EditVars.MaxPush < 1 ) { EditVars.MaxPush = 1; } InitFileStack(); break; case SET1_T_RADIX: EditVars.Radix = i; break; case SET1_T_AUTOSAVEINTERVAL: EditVars.AutoSaveInterval = i; SetNextAutoSaveTime(); break; case SET1_T_LANGUAGE: if( i < LANG_NONE || i >= LANG_MAX ) { return( ERR_INVALID_SET_COMMAND ); } if( CurrentInfo != NULL ) { LangFini( CurrentInfo->fsi.Language ); LangInit( i ); redisplay = TRUE; } break; case SET1_T_MOVECOLOR: EditVars.MoveColor = i; break; case SET1_T_RESIZECOLOR: EditVars.ResizeColor = i; break; case SET1_T_MOUSEDCLICKSPEED: EditVars.MouseDoubleClickSpeed = i; break; case SET1_T_MOUSESPEED: SetMouseSpeed( i ); break; case SET1_T_MOUSEREPEATDELAY: EditVars.MouseRepeatDelay = i; break; case SET1_T_CURRENTSTATUSCOLUMN: EditVars.CurrentStatusColumn = i; InitMenu(); break; case SET1_T_ENDOFLINECHAR: EditVars.EndOfLineChar = i; break; case SET1_T_EXITATTR: EditVars.ExitAttr = (char) i; break; case SET1_T_INACTIVEWINDOWCOLOR: EditVars.InactiveWindowColor = i; break; case SET1_T_TABAMOUNT: EditVars.TabAmount = i; break; case SET1_T_SHIFTWIDTH: EditVars.ShiftWidth = i; break; case SET1_T_PAGELINESEXPOSED: EditVars.PageLinesExposed = i; break; case SET1_T_HARDTAB: EditVars.HardTab = i; redisplay = TRUE; break; case SET1_T_STACKK: if( EditFlags.Starting ) { EditVars.StackK = i; } break; case SET1_T_LINENUMWINWIDTH: EditVars.LineNumWinWidth = i; break; case SET1_T_MAXWINDOWTILEX: EditVars.MaxWindowTileX = i; break; case SET1_T_MAXWINDOWTILEY: EditVars.MaxWindowTileY = i; break; case SET1_T_MAXSWAPK: SwapBlockInit( i ); break; case SET1_T_MAXEMSK: #ifndef NOEMS EMSBlockInit( i ); #endif break; case SET1_T_MAXXMSK: #ifndef NOXMS XMSBlockInit( i ); #endif break; case SET1_T_MAXFILTERHISTORY: FilterHistInit( i ); break; case SET1_T_MAXCLHISTORY: CLHistInit( i ); break; case SET1_T_MAXFINDHISTORY: FindHistInit( i ); break; case SET1_T_MAXLASTFILESHISTORY: LastFilesHistInit( i ); break; case SET1_T_MAXTILECOLORS: k = (EditVars.TileColors == NULL) ? 0 : EditVars.MaxTileColors + 1; EditVars.MaxTileColors = i; EditVars.TileColors = MemReAlloc( EditVars.TileColors, sizeof( type_style ) * ( EditVars.MaxTileColors + 1 ) ); for( ; k <= EditVars.MaxTileColors; ++k ) { EditVars.TileColors[k].foreground = -1; EditVars.TileColors[k].background = -1; EditVars.TileColors[k].font = -1; } break; case SET1_T_CLOCKX: EditVars.ClockX = i; GetClockStart(); break; case SET1_T_CLOCKY: EditVars.ClockY = i; GetClockStart(); break; case SET1_T_SPINX: EditVars.SpinX = i; GetSpinStart(); break; case SET1_T_SPINY: EditVars.SpinY = i; GetSpinStart(); break; case SET1_T_MAXLINELEN: /* file save fails if 1 line is > MAX_IO_BUFFER */ i = __min( i, MAX_IO_BUFFER ); EditVars.MaxLine = i; StaticStart(); WorkLine = MemReAlloc( WorkLine, sizeof( line ) + EditVars.MaxLine + 2 ); break; case SET1_T_TOOLBARBUTTONHEIGHT: EditVars.ToolBarButtonHeight = i; #ifdef __WIN__ ResizeRoot(); #endif break; case SET1_T_TOOLBARBUTTONWIDTH: EditVars.ToolBarButtonWidth = i; #ifdef __WIN__ ResizeRoot(); #endif break; case SET1_T_TOOLBARCOLOR: EditVars.ToolBarColor = i; #ifdef __WIN__ if( GetToolbarWindow() != NULL ) { InvalidateRect( GetToolbarWindow(), NULL, TRUE ); UpdateWindow( GetToolbarWindow() ); } #endif break; default: return( ERR_INVALID_SET_COMMAND ); } if( msgFlag ) { MySprintf( fn, "%s set to %d", GetTokenStringCVT( SetTokens1, j, settokstr, TRUE ), i ); } break; } } if( msgFlag && rc == ERR_NO_ERR && !EditFlags.Quiet ) { setMessage( fn, redisplay ); rc = DO_NOT_CLEAR_MESSAGE_WINDOW; } if( rc == ERR_NO_ERR && toggle ) { strcpy( value, save ); } return( rc ); #endif /* VICOMP */ } /* processSetToken */