static void
RedrawThumbs(ViewportWidget w)
{
    Widget child = w->viewport.child;
    Widget clip = w->viewport.clip;

    if (w->viewport.horiz_bar != NULL)
	SetBar(w->viewport.horiz_bar, -(int)XtX(child),
	       XtWidth(clip), XtWidth(child));

    if (w->viewport.vert_bar != NULL)
	SetBar(w->viewport.vert_bar, -(int)XtY(child),
	       XtHeight(clip), XtHeight(child));
}
Exemple #2
0
void Ide::SetMain(const String& package)
{
	FlushFile();
	SaveWorkspace();
	transferfilecache.Clear();
	main = package;
	export_dir = GetHomeDirFile(main);
	mainconfigname.Clear();
	mainconfigparam.Clear();
	ScanWorkspace();
	LoadFromFile(THISBACK(SerializeWorkspace), WorkspaceFile());
	editorsplit.Zoom(0);
	UpdateFormat();
	String e = editfile;
	editfile.Clear();
	MakeTitle();
	MakeIcon();
	SyncMainConfigList();
	AdjustMainConfig();
	SyncBuildMode();
	SetHdependDirs();
	SetBar();
	HideBottom();
	SyncUsc();
	NewCodeBase();
	if(IsNull(e))
		e = GetFirstFile();
	EditFile(e);
}
Exemple #3
0
void IconDes::SelectRect()
{
	doselection = false;
	Select();
	selectrect = true;
	SetBar();
}
Exemple #4
0
void IconDes::SetTool(void (IconDes::*_tool)(Point p, dword flags))
{
	FinishPaste();
	if(HasCapture())
		ReleaseCapture();
	tool = _tool;
	SetBar();
}
Exemple #5
0
void Ide::BuildAndDebug(bool runto)
{
	VectorMap<String, String> bm = GetMethodVars(method);
	String builder = bm.Get("BUILDER", "");
	if(!Build())
		return;
	if(!FileExists(target))
		return;
	if(designer)
		EditAsText();
	One<Host> host = CreateHostRunDir();
	host->ChDir(Nvl(rundir, GetFileFolder(target)));
	HideBottom();
	editor.Disable();
#ifdef COMPILER_MSC
	if(builder == "GCC")
		if(gdbSelector)
			debugger = Gdb_MI2Create(host, target, runarg);
		else
			debugger = GdbCreate(host, target, runarg);
	else
		debugger = PdbCreate(host, target, runarg);
#else
	if(gdbSelector)
		debugger = Gdb_MI2Create(host, target, runarg);
	else
		debugger = GdbCreate(host, target, runarg);
#endif
	if(!debugger) return;
	debuglock = 0;
	const Workspace& wspc = IdeWorkspace();
	for(int i = 0; i < wspc.GetCount(); i++) {
		const Package& pk = wspc.GetPackage(i);
		String n = wspc[i];
		for(int i = 0; i < pk.file.GetCount(); i++) {
			String file = SourcePath(n, pk.file[i]);
			LineInfo& ln = Filedata(file).lineinfo;
			for(int i = 0; i < ln.GetCount(); i++) {
				LineInfoRecord& lr = ln[i];
				if(!lr.breakpoint.IsEmpty())
					if(!debugger->SetBreakpoint(file, lr.lineno, lr.breakpoint)) {
						lr.breakpoint = "\xe";
						if(PathIsEqual(file, editfile))
							editor.SetBreakpoint(lr.lineno, "\xe");
					}
			}
		}
	}
	SetBar();
	editor.Enable();
	if(runto) {
		if(!debugger->RunTo())
			IdeEndDebug();
	}
	else
		debugger->Run();
}
Exemple #6
0
void Ide::History(int d)
{
	int i = GetHistory(d);
	if(i >= 0) {
		histi = i;
		GotoBookmark(history[histi]);
		SetBar();
	}
}
Exemple #7
0
void IconDes::CancelSelect()
{
	ReleaseCapture();
	doselection = false;
	rgbactrl.Mask(false);
	FinishPaste();
	SetSelect(255);
	SetBar();
}
Exemple #8
0
void Ide::CheckUpdates(bool verbose){
	LLOG("CheckUpdates, verbose="<<verbose);
	if(verbose){
		su.NeedsUpdate(true);
		SetBar();
	}else{
		su.WhenUpdateAvailable=THISBACK(SetBar);
		su.CheckUpdates();
	}
}
Exemple #9
0
void IconDes::Paste(const Image& img)
{
	FinishPaste();
	if(!IsCurrent())
		return;
	Slot& c = Current();
	c.base_image = c.image;
	c.paste_image = img;
	c.pastepos = Point(0, 0);
	MakePaste();
	SetBar();
}
Exemple #10
0
void IconDes::SetColor0(RGBA color)
{
	FinishPaste();
	doselection = false;
	rgbactrl.Mask(false);
	SaveUndo();
	ImageBuffer ib(Current().image);
	MaskFill(ib, color, 255);
	Refresh();
	SetCurrentImage(ib);
	SyncShow();
	SetBar();
}
Exemple #11
0
void Ide::PackageCursor()
{
	WorkspaceWork::PackageCursor();
	String p = GetActivePackage();
	if(p.IsEmpty()) return;
	String ef = ToLower(NormalizePath(editfile));
	for(int i = 0; i < filelist.GetCount(); i++)
		if(ToLower(NormalizePath(SourcePath(p, filelist[i]))) == ef) {
			filelist.SetCursor(i);
			break;
		}
	SetBar();
}
Exemple #12
0
void HelpWindow::Forward()
{
	Pos p = GetPos();
	if(forward.GetCount() && GoTo0(forward.Top().link)) {
		if(forward.GetCount()) {
			view.SetSb(forward.Top().scy);
			forward.Drop();
		}
		if(!IsNull(p.link))
			back.Add(p);
		SetBar();
	}
}
Exemple #13
0
void HelpWindow::Back()
{
	Pos p = GetPos();
	if(back.GetCount() && GoTo0(back.Top().link)) {
		if(back.GetCount()) {
			view.SetSb(back.Top().scy);
			back.Drop();
		}
		if(!IsNull(p.link))
			forward.Add(p);
		SetBar();
	}
}
Exemple #14
0
void Ide::AddHistory()
{
	if(history.GetCount()) {
		if(IsHistDiff(histi))
			++histi;
	}
	else
		histi = 0;
	history.At(histi);
	Bookmark& b = history.Top();
	b.file = editfile;
	b.pos = editor.GetEditPos();
	SetBar();
}
Exemple #15
0
void IconDes::LeftUp(Point p, dword keyflags)
{
	if(!IsCurrent())
		return;
	if(IsPasting() && HasCapture())
		Refresh();
	else
	if(HasCapture() && selectrect)
		Move();
	else
		Current().base_image.Clear();
	SetBar();
	SyncShow();
}
Exemple #16
0
void HelpWindow::GoTo(const String& link)
{
	if(IsNull(link) || current_link == link)
		return;
	Pos p = GetPos();
	if(GoTo0(link)) {
		if(!IsNull(p.link))
			back.Add(p);
		forward.Clear();
		SetBar();
		return;
	}
	if(link.StartsWith("www.") || link.StartsWith("http") || link.StartsWith("mailto:"))
		LaunchWebBrowser(link);
}
Exemple #17
0
void IconDes::Select()
{
	if(!IsCurrent())
		return;
	ReleaseCapture();
	FinishPaste();
	doselection = !doselection;
	rgbactrl.Mask(doselection);
	if(doselection && SelectionRect() == GetImageSize()) {
		SetSelect(0);
		rgbactrl.MaskSet(255);
	}
	Refresh();
	SetBar();
}
Exemple #18
0
void Ide::SetupOutputMode()
{
	String prevmainconfig = mainconfigparam;
	SetupDefaultMethod();
	OutMode m(*this);
	m.Load();
	if(m.Execute() != IDOK) {
		mainconfigparam = prevmainconfig;
		return;
	}
	m.Save();
	if(prevmainconfig != mainconfigparam)
		SetMainConfigList();
	SyncBuildMode();
	SetBar();
}
Exemple #19
0
void Ide::SetIdeState(int newstate) {
	if(newstate != idestate)
	{
		if(newstate == BUILDING)
			build_start_time = GetSysTime();
		else
		{
			if(idestate == BUILDING && !IsNull(build_start_time))
				stat_build_time += int(GetSysTime() - build_start_time);
			build_start_time = Null;
		}
	}
	idestate = newstate;
	MakeTitle();
	SetBar();
}
Exemple #20
0
void IconDes::Undo()
{
	if(!IsCurrent())
		return;
	Slot& c = Current();
	Vector<Image> undo = UnpackImlData(c.undo);
	if(undo.GetCount() == 0)
		return;
	Vector<Image> redo = UnpackImlData(c.redo);
	redo.Add(c.image);
	c.image = undo.Pop();
	c.supersampling = sRemoveSsFlag(c.image);
	c.undo = PackImlData(undo);
	c.redo = PackImlData(redo);
	SyncImage();
	SetBar();
}
Exemple #21
0
void IconDes::SyncImage()
{
	ReleaseCapture();
	SyncShow();
	if(IsCurrent()) {
		Slot& c = Current();
		SyncShow();
		c.pastepos = Null;
		if(c.selection.GetSize() != c.image.GetSize())
			SetSelect(255);
		if(single_mode)
			info.SetLabel(Format("%d x %d", c.image.GetWidth(), c.image.GetHeight()));
	}
	selectrect = false;
	SetBar();
	Refresh();
}
Exemple #22
0
void Ide::ToggleReadOnly()
{
	if(CanToggleReadOnly() && IsActiveFile()) {
#ifdef PLATFORM_WIN32
		FindFile ff(editfile);
		if(ff && ff.IsReadOnly()) {
			dword attrib = GetFileAttributes(editfile);
			attrib &= ~FILE_ATTRIBUTE_READONLY;
			SetFileAttributes(editfile, attrib);
		}
#endif
		editor.SetEditable(editor.IsReadOnly());
		ActiveFile().readonly = editor.IsReadOnly();
		SavePackage();
		MakeTitle();
		SetBar();
	}
}
Exemple #23
0
void Ide::CheckUpdatesManual(){
	int tmp=UpdaterCfg().ignored;
	UpdaterCfg().ignored=0;
	su.ClearError();
	if(su.NeedsUpdate(true)){
		su.Execute();
	}else{
		String err=su.GetError();
		if(err=="CANCEL") return;
		if(!err.IsEmpty()){
			Exclamation("Unable to check for updates. "+err);
		}else{
			PromptOK("No update found. You are using version "+su.GetLocal()+".");
		}
		UpdaterCfg().ignored=tmp;
	}
	SetBar();
}
Exemple #24
0
void IconDes::SaveUndo()
{
	if(!IsCurrent())
		return;
	Slot& c = Current();
	Vector<Image> undo = UnpackImlData(c.undo);
	int maxn = minmax((single_mode ? 4000000 : 400000) / max(c.image.GetLength(), 1), 4, 128);
	while(undo.GetCount() > maxn)
		undo.Remove(0);
	if(undo.GetCount() && undo.Top() == c.image)
		return;
	sSetSsFlag(c.image, c.supersampling);
	undo.Add(c.image);
	c.undo = PackImlData(undo);
	c.redo.Clear();
	SetBar();
	undo.Clear();
	sRemoveSsFlag(c.image);
}
Exemple #25
0
bool HelpWindow::GoTo0(const String& link)
{
	if(IsNull(link) || current_link == link)
		return true;
	Topic t = AcquireTopic(link);
	SetBar();
	if(!IsNull(t.text)) {
		label = t.label;
		topic = t.link;
		Title(FromUtf8(t.title));
		RichText txt = ParseQTF(t.text);
		FinishText(txt);
		view.Pick(pick(txt), zoom);
		view.GotoLabel(label, true);
		current_link = link;
		tree.FindSetCursor(topic);
		return true;
	}
	return false;
}
Exemple #26
0
void Ide::SyncBottom()
{
	int q = btabs.GetCursor();
	if(q == BCLOSE) {
		HideBottom();
		return;
	}
	if(editor_bottom.GetZoom() >= 0)
		editor_bottom.NoZoom();
	console.Show(q == BCONSOLE);
	console2.Show(q == BCONSOLE2);
	calc.Show(q == BCALC);
	if(bottomctrl)
		bottomctrl->Show(q == BDEBUG);
	calc.LoadHlStyles(editor.StoreHlStyles());
	calc.SetFont(editorfont);
	SetBar();
	if(q == BCALC)
		ActiveFocus(calc);
}
Exemple #27
0
void IconDes::Move()
{
	if(!IsCurrent())
		return;
	Slot& c = Current();
	selectrect = false;
	if(IsPasting())
		FinishPaste();
	else {
		doselection = false;
		rgbactrl.Mask(false);
		rgbactrl.Hide();
		Rect r = SelectionRect();
		Image m = Copy(r);
		Delete();
		SetSelect(255);
		c.base_image = c.image;
		c.paste_image = m;
		c.pastepos = r.TopLeft();
		MakePaste();
	}
	SetBar();
}
Exemple #28
0
HelpWindow::HelpWindow()
{
	tree_view.Horz(tree, view);
	tree_view.SetPos(3000);
	Add(tree_view.SizePos());
	tree_view.Zoom(1);
	Sizeable().Zoomable();
	Title(t_("Help"));
	BackPaint();
	view.WhenLink = THISBACK(GoTo);
	AddFrame(toolbar);
	view.SetZoom(Zoom(1, 1));
	zoom.m = 160;
	SetZoom();
	view.Margins(Rect(12, 0, 12, 0));
	SetRect(Ctrl::GetWorkArea().Deflated(80));
	tree.WhenSel = THISBACK(TreeCursor);
	tree.NoRoot();
	Icon(CtrlImg::help());
	SetBar();
	tree.BackPaint();
	view.BackPaintHint();
}
INT SetAttr( VOID )
{
    INT              attr, done, code;
    KEY              k;
    PACKET           packet;
    
    SetBar( BarNull );

    wattr = WDefine( 0, 6, 32, 23, 12, W_NOSCROLL | W_NOCURSOR | W_SHADOW, BORDER2, " Attributes " );

    WPrints ( wattr, 1,  0, "Private             <Alt-P>" );
    WPrints ( wattr, 1,  1, "Crash               <Alt-C>" );
    WPrints ( wattr, 1,  2, "Received            <Alt-R>" );
    WPrints ( wattr, 1,  3, "Sent                <Alt-S>" );
    WPrints ( wattr, 1,  4, "File Attach         <Alt-A>" );
    WPrints ( wattr, 1,  5, "Transit             <Alt-J>" );
    WPrints ( wattr, 1,  6, "Orphan              <Alt-O>" );
    WPrints ( wattr, 1,  7, "Kill/Sent           <Alt-K>" );
    WPrints ( wattr, 1,  8, "Local               <Alt-W>" );
    WPrints ( wattr, 1,  9, "Hold                <Alt-H>" );
    WPrints ( wattr, 1, 10, "File Request        <Alt-F>" );
    WPrints ( wattr, 1, 11, "Return Rcpt Request <Alt-M>" );
    WPrints ( wattr, 1, 12, "Return Rcpt         <Alt-N>" );
    WPrints ( wattr, 1, 13, "Audit Request       <Alt-Q>" );
    WPrints ( wattr, 1, 14, "File Update Request <Alt-U>" );
    WPrints ( wattr, 1, 15, "Zap all attribs     <Alt-Z>" );

    WActive( wattr );
    attr = Current -> attr;
    done = 0;
    while( !done )
    {
        ViewAttr();
        
        k = MGetKey( FALSE );
        
        switch( k.key )
        {
            case ALT_P: Current -> attr ^= PKT_PVT; break;
            case ALT_C: Current -> attr ^= PKT_CRA; break;
            case ALT_R: Current -> attr ^= PKT_RCV; break;
            case ALT_S: Current -> attr ^= PKT_SNT; break;
            case ALT_A: Current -> attr ^= PKT_ATT; break;
            case ALT_J: Current -> attr ^= PKT_TRS; break;
            case ALT_O: Current -> attr ^= PKT_ORP; break;
            case ALT_K: Current -> attr ^= PKT_KS;  break;
            case ALT_W: Current -> attr ^= PKT_LOC; break;
            case ALT_H: Current -> attr ^= PKT_HLD; break;
            case ALT_F: Current -> attr ^= PKT_FRQ; break;
            case ALT_M: Current -> attr ^= PKT_RRQ; break;
            case ALT_N: Current -> attr ^= PKT_RRC; break;
            case ALT_Q: Current -> attr ^= PKT_ARQ; break;
            case ALT_U: Current -> attr ^= PKT_URQ; break;
            case ALT_Z: Current -> attr  = 0;       break;
                
            case KEY_ESC: case KEY_ENTER: case KEY_GRENTER: case KEY_F10:
                done = 1;
                break;
        }
    }
    
    WRelease( wattr );
    
    if( k.key != KEY_ESC && attr != Current -> attr )
    {
        PktUpdate = 1;
        if( mode == FILE_TYPE_PKT )
        {
            FidoMsgGetStrSeek( PktFile, Current -> tell, SEEK_SET );
            if( fread ( &packet, sizeof( packet ), 1, PktFile ) != 1 )
                ShowError( "Error read file '%s'", ShowPath( netfile, 50 ));
            else
            {
                packet.attr = Current -> attr;
                FidoMsgGetStrSeek( PktFile, Current -> tell, SEEK_SET );
                if( fwrite( &packet, sizeof( packet ), 1, PktFile ) != 1 )
                    ShowError( "Error write to file '%s'", ShowPath( netfile, 50 ));
            }
        }
        if( mode == FILE_TYPE_MSG )
        {
            if(( code = OpenFile( Current -> name )) != 0 )
                return( code );
            if( fread( &msg, sizeof( msg ), 1, PktFile ) != 1 )
                ShowError( "Error read file '%s'", ShowPath( netfile, 50 ));
            else
            {
                msg.attrib = Current -> attr;
                fseek ( PktFile, 0, SEEK_SET );
                if( fwrite( &msg, sizeof( msg ), 1, PktFile ) != 1 )
                    ShowError( "Error write to file '%s'", ShowPath( netfile, 50 ));
            }
            CloseFile();
        }
    }
    else
        Current -> attr = attr;

    ViewAttr();

    return( 0 );
}
/*-------------------------------------------------------------------------*/
INT ViewMsg( CHAR *file, INT renew )
{
    INT              y = 0;
    KEY              k;
    INDEXTXT        *p;
#ifndef _LITE_
    INT              code;
#endif

    WActive ( wmain );
    WActive ( wtext );
    WActive ( wbar  );
#ifndef _LITE_
    SetBar  ( BarView );
#endif
    if( renew )
    {
        ViewHeader( file );
        ViewPage  ( maxXtext, maxYtext, 0 );
    }

    while( 1 )
    {
        k = MGetKey( FALSE );

        switch( k.key )
        {
#ifndef _LITE_
            
            case KEY_F1:
                ViewHelp( "PktView" );
                SetBar( BarView );
                break;

            case KEY_F5:
                CheckUpdatePkt( file );
                CopyPkt( file );
                SetBar( BarView );
                break;
                
            case KEY_F6:
                CheckUpdatePkt( file );
                code = MovePkt( file );
                SetBar( BarView );
                if( code ) break;
                if( mode == FILE_TYPE_MSG )
                {
                    ReindexPkt();
                    WDeactive( wmain );
                    WDeactive( wtext );
                    return( KEY_ESC );
                }
                if( mode == FILE_TYPE_PKT )
                {
                    reload = 1;
                    return( KEY_ESC );
                }
                return( 0 );
                
            case KEY_F8: case KEY_DEL:
                code = DelPkt( file );
                SetBar( BarView );
                if( code ) break;
                if( mode == FILE_TYPE_MSG )
                {
                    ReindexPkt();
                    WDeactive( wmain );
                    WDeactive( wtext );
                    return( KEY_ESC );
                }
                if( mode == FILE_TYPE_PKT )
                {
                    reload = 1;
                    return( KEY_ESC );
                }
                return( 0 );

            case KEY_i: case KEY_I: case ALT_I:
                ShowInfo( file );
                SetBar( BarView );
                break;
                
            case KEY_SPACE: case KEY_INS:
                if( pktIndex == NULL )
                    break;
                if( Current -> sel != ' ' )
                {
                    Current -> sel = ' ';
                    selected--;
                }
                else
                {
                    Current -> sel = '*';
                    selected++;
                }
                ViewSelected();
                break;
                
            case KEY_F3:
                return( KEY_F3 );
                
            case ALT_C:
                SetAttr();
                SetBar( BarView );
                break;
                
            case KEY_F9:
                ChangeConfig();
                SetBar( BarView );
                if( altx )
                {
                    WDeactive( wmain );
                    WDeactive( wtext );
                    return( KEY_ESC );
                }
                break;
                
            case SHIFT_F9:
                SaveConfig( ConfFile );
                break;

#endif

            case KEY_HOME:
                if( y == 0 )
                    break;
                y = 0;
                ViewPage( maxXtext, maxYtext, y );
                break;

            case KEY_DOWN:
                if( txtcount < y + maxYtext + 1 )
                    break;
                y++;
                WSetXY( wtext, 0, 0 ); WDelLine( wtext );
                p = GetCurrentTxt( y + maxYtext - 1 );
                ViewStr ( wtext, maxYtext - 1, maxXtext, p -> str, p -> color );
                break;

            case KEY_UP:
                if( y == 0 )
                    break;
                y--;
                WSetXY( wtext, 0, 0 ); WInsLine( wtext );
                p = GetCurrentTxt( y );
                ViewStr ( wtext, 0, maxXtext, p -> str, p -> color );
                break;

            case KEY_PAGEUP:
                if( y == 0 )
                    break;
                if( y < maxYtext - 1 )
                    y = 0;
                else
                    y -= maxYtext - 1;
                ViewPage( maxXtext, maxYtext, y );
                break;

            case KEY_PAGEDOWN:
                if( txtcount < maxYtext )
                    break;
                if( y + 2 * maxYtext < txtcount )
                    y += maxYtext - 1;
                else
                    y  = txtcount - maxYtext;
                ViewPage( maxXtext, maxYtext, y );
                break;

            case KEY_END:
                if( txtcount < maxYtext )
                    break;
                y = txtcount - maxYtext;
                ViewPage( maxXtext, maxYtext, y );
                break;

            case KEY_LEFT: case CTRL_ENTER: case SHIFT_TAB:
                if( pktcount > 1 && pktNumber > 0 )
                    return( KEY_LEFT );
                break;

            case KEY_RIGHT: case KEY_ENTER: case KEY_GRENTER: case KEY_TAB:
                if( pktcount > 1 && pktNumber + 1 != pktcount )
                    return( KEY_RIGHT );
                break;

            case ALT_X:
                altx = 1;
                
            case KEY_ESC: case KEY_F10: case KEY_L: case KEY_l: case ALT_L:
                WDeactive( wmain );
                WDeactive( wtext );
                return( KEY_ESC );

        }
    }
}