Beispiel #1
0
HelpWin::HelpWin(int rows, int cols) : NGroup(NRect(rows, cols, getmaxy(stdscr)/2-rows/2,getmaxx(stdscr)/2-cols/2))
{
    caption = strdup(" Hot keys list ");
    modalflag = true;
    resize(17,60);
    wattrset(win,getcolorpair(COLOR_WHITE, COLOR_BLACK) | A_BOLD);
    if(asciilinedraw == 1)
	wborder(win, '|', '|', '-', '-', '+', '+', '+', '+');
    else
	box(win,0,0);
    mvwprintw(win,0,getwidth()/2-(strlen(caption)/2),caption);
    text1 = new NStaticText(NRect(getheight()-2,getwidth()-2,/*rect.begrow+*/1,/*rect.begcol+*/1));
    int attr1 = getcolorpair(COLOR_YELLOW, COLOR_BLACK) | A_BOLD;
    int attr2 = getcolorpair(COLOR_WHITE, COLOR_BLACK) | A_BOLD;
    text1->setstring(attr1,   "\n   Common Controls:\n");
    text1->appendstring(attr2,"       \"N\"           - Toogle between BOINC hosts\n");
    text1->appendstring(attr2,"       \"C\"           - Edit configuration\n");
    text1->appendstring(attr2,"       \"Q\"           - Quit boinctui\n");
    text1->appendstring(attr2,"       \"F9\"          - Toogle main menu\n");
    text1->appendstring(attr2,"       \"PgUp\"/\"PgDn\" - Scroll Messages Window\n");
    text1->appendstring(attr2,"\n");
    text1->appendstring(attr1,"   Task Controls:\n");
    text1->appendstring(attr2,"       \"Up\"/\"Dn\"     - Select task\n");
    text1->appendstring(attr2,"       \"S\"           - Suspend selected running task\n");
    text1->appendstring(attr2,"       \"R\"           - Resume selected suspended task\n");
    text1->appendstring(attr2,"       \"A\"           - Abort selected task\n");
    text1->appendstring(attr2,"       \"Enter\"       - View selected task raw info\n");
    insert(text1);
}
Beispiel #2
0
edit_window_t::edit_window_t()
:	ntk_window(
		ted()->conf().get_rect("edit_window_t::frame", NRect(100, 100, 600, 500)),
		WINDOW_TITLE("untitled"), TITLED_WINDOW)
,	m_file_name("")
{
	set_icon_handle(LoadIcon(ntk::application()->handle(), MAKEINTRESOURCE(ID_TED_ICON)));

	panel()->set_view_color(ntk::transparent_color());

	ntk_std_menu_bar* menu_bar = new ntk_std_menu_bar(
		LoadMenu(ted()->handle(), MAKEINTRESOURCE(ID_APP_MENU)),
		ntk_rect(0, 0, 10, 10), "Menu");
	add_child(menu_bar);

	int width_list[] = {100, 100, 200};
	ntk_status_bar* status_bar = new ntk_status_bar("TestStatusBar");//, 3, width_list);
	add_child(status_bar);

//	add_child(new NScrollBar(bounds().inset_by_copy(10, 10), "VScrollBar", NULL, 0, 50));

	ntk_rect rect = bounds();
	rect.top += menu_bar->frame().height();
	rect.bottom -= status_bar->frame().height();

	m_edit = new ntk_scintilla(rect, "Text", "", ntk_view::FOLLOW_ALL_SIDES);
//	m_edit->set_ex_style(m_edit->ex_style() | WS_EX_CLIENTEDGE, true);
	add_child(m_edit);
}
Beispiel #3
0
HitRect *Scene::findHitRectAtPos(int16 x, int16 y) {
    static HitRect kDefaultHitRect = {NRect(), 0x5000};
    if (_hitRects)
        for (HitRectList::iterator it = _hitRects->begin(); it != _hitRects->end(); it++)
            if ((*it).rect.contains(x, y))
                return &(*it);
    return &kDefaultHitRect;
}
Beispiel #4
0
NewDocumentDialog::NewDocumentDialog()
:	NWindow(
		new NDialogPanel(
			MAKEINTRESOURCE(ID_NEW_DOCUMENT_DIALOG), NRect(), "NewDialog",
			NView::FOLLOW_LEFT | NView::FOLLOW_TOP, NDialogPanel::RESIZE_TO_FIT),
		NRect(100, 100, 300, 300), "�V�K�쐬", TITLED_LOOK, MODAL_APP_FEEL,
		NOT_RESIZABLE | NOT_ZOOMABLE | NOT_MINIMIZABLE)
{
	NDialogPanel* dialog_panel = reinterpret_cast<NDialogPanel*>(panel());
	SetDlgItemText(dialog_panel->handle(), ID_WIDTH, "160");
	SetDlgItemText(dialog_panel->handle(), ID_HEIGHT, "120");

	resize_to(dialog_panel->frame().width(), dialog_panel->frame().height());
	move_to(
		(NScreen::frame().width() - frame().width()) /2,
		(NScreen::frame().height() - frame().height()) /2);
}
Beispiel #5
0
PreviewPanel::PreviewPanel(const NString& name)
:	NPanel(NRect(), name, DEFAULT_RESIZING_MODE, DEFAULT_FLAGS, ntk::white_color())
,	m_play_thread(NULL)
,	m_stop(false)
,	m_pause(false)
,	m_animation(NULL)
{
}
Beispiel #6
0
void
BrushStroke::mouse_moved(const NPoint& point, uint buttons)
{
	if(m_mouse_down_outside &&
		NRect(0, 0, m_canvas->image()->width(), m_canvas->image()->height()).contains(point))
	{
		m_mouse_down_outside = false;
		begin_painting();
	}
}
Beispiel #7
0
NMessageBox::NMessageBox(const char* text) : NGroup(NRect(3, 40, 1, 1))
{
    //расчитать сколько строк нужно для отображения контента
    int contentheight = 0;
    int bsize = strlen(text); //количество байт
    int result = 0; //подсчитанное кол-во символов
    int nbytes = 0; //просмотренное кол-во байтов
    int nlines = 0; //количество экранных строк
    int col = getwidth() - 4;
    const char* p = text;
    do
    {
	col++;
	if ((col >= getwidth() - 4)||(*p == '\n'))
	{
	    if (*p == '\n')
		col = 0;
	    else
		col = 1;
	    contentheight++; //след строка
	}
	int symlen = mblen(p,bsize-nbytes);
	nbytes = nbytes + symlen;
	result++;
	p = p + symlen; //адрес начала след символа
    }
    while ( (*p != 0)&&(nbytes < bsize) ); //дошли до конца
    //заполняем содержимое
    content = new NStaticText(NRect(contentheight, getwidth()-4, 2, 2));
    content->setbgcolor(getcolorpair(COLOR_WHITE, COLOR_BLACK));
    insert(content);
    content->appendstring(getcolorpair(COLOR_WHITE, COLOR_BLACK) | A_BOLD, text);
    modalflag = true;
    resize(contentheight + 6,getwidth());
    wattrset(win,getcolorpair(COLOR_WHITE, COLOR_BLACK) | A_BOLD);
    if(asciilinedraw == 1)
	wborder(win, '|', '|', '-', '-', '+', '+', '+', '+');
    else
	box(win,0,0);
    //content->setalign(1);
    move(getmaxy(stdscr)/2-getheight()/2,getmaxx(stdscr)/2-getwidth()/2); //центрируем

}
Beispiel #8
0
void
BrushStroke::mouse_down(const NPoint& point, uint buttons, bool dbl)
{
	m_brush = titoon()->window()->tool_box()->paint_box()->brush();


	if(NRect(0, 0, m_canvas->image()->width(), m_canvas->image()->height()).contains(point))
		begin_painting();
	else
		m_mouse_down_outside = true;
}
Beispiel #9
0
void NFloatProp::Init()
{
	float fVal;
	m_pvarBloc->GetValue(m_dwvarIdx, 0.0f, fVal);
	NVarsBlocDesc* pbd = m_pvarBloc->GetValueDesc(m_dwvarIdx);
	m_slider.Create(pbd->pszName, NRect(0,0,0,0), m_pParent);
	m_slider.SetRange(pbd->fMin, pbd->fMax);
	m_slider.SetStep(pbd->fStep);
	m_slider.SetPos(fVal);
	m_slider.OnValueChanged = FDelegate(this, (TDelegate)&NFloatProp::OnValueChanged);
}
Beispiel #10
0
void NColorProp::Init()
{
	udword dwVal;
	m_pvarBloc->GetValue(m_dwvarIdx, 0.0f, dwVal);

	NColor col;
	col.SetFromRGBA(dwVal);

	m_button.Create(col, NRect(0,0,0,0), m_pParent, 0);
	m_button.OnChanged = FDelegate(this, (TDelegate)&NColorProp::OnValueChanged);
}
Beispiel #11
0
void NStringProp::Init()
{
	char* psz;
	m_pvarBloc->GetValue(m_dwvarIdx, 0.0f, psz);

	NVarsBlocDesc* pbd = m_pvarBloc->GetValueDesc(m_dwvarIdx);
	m_edit.Create(pbd->pszName, NRect(0,0,0,0), m_pParent);
	m_edit.SetText(psz);

	m_edit.OnEnter = FDelegate(this, (TDelegate)&NStringProp::OnValueChanged);
}
Beispiel #12
0
MainProg::MainProg()
{
    uistate = 0;
    done = false;
    gCfg = new Config(".boinctui.cfg");
    gsrvlist = new SrvList(/*cfg*/);
    evtimertime = 0; //запускаем таймер с нуля
    //основное окно
    wmain 	= new MainWin(NRect(getmaxy(stdscr)-2, getmaxx(stdscr), 1, 0)/*, cfg*/); //создаем основное окно
    insert(wmain);
    wmain->setserver(gsrvlist->getcursrv()); //отображать первый в списке сервер
    menu = new TopMenu(/*cfg*/);
    menu->setserver(gsrvlist->getcursrv()); //отображать первый в списке сервер
    insert(menu);
    wmain->updatecaption();
    //статус строка
    wstatus 	= new NStaticText(NRect(1, getmaxx(stdscr), getmaxy(stdscr)-1, 0)); //создаем окно статуса
    insert(wstatus);
    wstatus->setbgcolor(getcolorpair(COLOR_WHITE,COLOR_GREEN));
    updatestatuslinecontent();
}
Beispiel #13
0
//-----------------------------------------------------------------
//!	\brief	Control creation
//-----------------------------------------------------------------
bool NMenuCtrl::Create(char* name, NGUIWnd* parent)
{
	//Call Base class
	NWNDCREATE			wc;
	wc.dwId					= 1;
	wc.pszText			= name;
	wc.pwndParent		= parent;
	wc.rcRect				= NRect(0,0,0,0);
	wc.dwStyle			= NWS_POPUP;
	NGUIWnd::Create(wc);

	return true;
}
Beispiel #14
0
MainWin::MainWin(NRect rect/*, Config* cfg*/) : NGroup(rect)
{
    //читаем опции из конфига если нет то создаем
    wtaskheightpercent = 5000;
    if (gCfg != NULL)
    {
	Item* rootcfg = gCfg->getcfgptr();
	if (rootcfg != NULL)
	{
	    Item* wtask_height_percent = rootcfg->findItem("wtask_height_percent");
	    if (wtask_height_percent == NULL) //создать
	    {
		wtask_height_percent = new Item("wtask_height_percent");
		wtask_height_percent->setivalue(wtaskheightpercent);
		rootcfg->addsubitem(wtask_height_percent);
	    }
	    wtaskheightpercent = wtask_height_percent->getivalue();
	}
    }
    colname.push_back("  #  ");
    colname.push_back("state ");
    colname.push_back("   done%%");
    colname.push_back("  project             ");
    colname.push_back("  est");
    colname.push_back("  d/l");
    colname.push_back("  application                   ");
    colname.push_back("  task");
    tablheader = new NStaticText(NRect(1, rect.cols -2-(INFPANWIDTH)-1, 1, 1));
    tablheader->setstring(getcolorpair(COLOR_CYAN,COLOR_BLACK) | A_BOLD,"  #  state    done%%  project               est d/l   task");
    int wtaskheight = getheight() * wtaskheightpercent / 10000.0;
    if (wtaskheight < 5)
	wtaskheight = 5;
    if (wtaskheight > getheight() - 10)
	wtaskheight = getheight() - 10;
    wtask = new TaskWin(NRect(wtaskheight/*getheight()/2*/, getwidth()-2-(INFPANWIDTH)-1, 2, 1)); //создаем окно процессов внутри wmain
    setcoltitle();
    taskscrollbar = new NScrollBar(NRect(wtask->getheight()+2,1, wtask->getbegrow()-2, getwidth()-INFPANWIDTH-2), ACS_TTEE | A_BOLD, 0, ACS_VLINE | A_BOLD); //скроллбар панели задач
    wtask->setscrollbar(taskscrollbar);
    wmsg = new MsgWin(NRect(getheight()-wtask->getheight()-4, getwidth()-2-(INFPANWIDTH+1), wtask->getheight()+3, 1)); //создаем окно евентов
    hline = new NHLine(NRect(1, getwidth()-2-(INFPANWIDTH+1), wtask->getheight()+2, 1), NULL); //горизонтальная линия
//    vline = new NVLine(NRect(wtask->getheight()+1/*getheight()-2*/, 1, 1, getwidth()-INFPANWIDTH-2), NULL); //вертикальная линия
    msgscrollbar = new NScrollBar(NRect(wmsg->getheight()+2,1, wmsg->getbegrow()-1, getwidth()-INFPANWIDTH-2/*vline->getbegcol()*/),/*ACS_RTEE*/ACS_VLINE | A_BOLD,ACS_BTEE | A_BOLD, ACS_VLINE | A_BOLD); //скроллбар панели сообщений
    wmsg->setscrollbar(msgscrollbar);
    panel1 = new InfoPanel(NRect(getheight()-2,INFPANWIDTH,1,getwidth()-INFPANWIDTH-1));
    caption = new NColorString(0,"");
    insert(tablheader);
    insert(wtask);
    insert(wmsg);
    insert(hline);
//    insert(vline);
    insert(taskscrollbar);
    insert(msgscrollbar);
    insert(panel1);
}
Beispiel #15
0
//-----------------------------------------------------------------
//!	\brief	Init Application
//!	\return	True if success
//-----------------------------------------------------------------
bool NFxGenApp::Init()
{
	// Create main window
	m_appWnd.Create(sf::VideoMode(WIDTH, HEIGHT), CAPTION);

	// GUI SubSystem
	NGUISubSystem* pgui = GetGUISubSystem();
	pgui->Init();

	//Create Main Frame Window
	NMainFrm* frame = NNEW( NMainFrm );
	pgui->SetMainWnd(frame);

	frame->Create(CAPTION, NRect(0,0,WIDTH,HEIGHT));	//###TOFIX### not reel client size (see wnd caption...)

	return true;
}
Beispiel #16
0
NMButton::NMButton(const char* text, NEvent* pevent, ...) : NStaticText(NRect(3, 20, getmaxy(stdscr)/2-3/2,getmaxx(stdscr)/2-20/2))
{

    appendstring(getcolorpair(COLOR_WHITE, COLOR_CYAN)," ");
    appendstring(getcolorpair(COLOR_WHITE, COLOR_CYAN) | A_BOLD ,text);
    appendstring(getcolorpair(COLOR_WHITE, COLOR_CYAN)," ");
    this->pevent = pevent;
    //размер кнопки
    resize(1, mbstrlen(text) + 2);
    //список клавиш на которые реагирует эта кнопка
    va_list pk;
    va_start(pk, pevent);
    int ch = va_arg(pk, int);
    while ( ch != 0)
    {
	keys.push_back((char)ch);
	ch = va_arg(pk, int); //следующий ключ
    }
    va_end(pk);
}
Beispiel #17
0
void NUbyteComboProp::Init()
{
	ubyte byVal;
	m_pvarBloc->GetValue(m_dwvarIdx, 0.0f, byVal);

	//Make menu items
	NVarsBlocDesc* pbd = m_pvarBloc->GetValueDesc(m_dwvarIdx);

	NString str;
	str = pbd->pszDefValue;

	NString word;
	udword i=3;
	do
	{
		i = str.ExtractToken(i, word, ",]");
		if (i!=-1)
		{
			m_carrayStringsList.AddItem(word);
			i+=word.Length()+1;
		}

	} while (i!=-1);

	//Create menu button
	ubyte val = byVal;
	word = "?";
	if (val<(ubyte)m_carrayStringsList.Count())
		word = m_carrayStringsList[val].Buffer();

	m_button.Create(word.Buffer(), NRect(0,0,0,0), m_pParent, 0);
	m_button.OnChanged = FDelegate(this, (TDelegate)&NUbyteComboProp::OnValueChanged);

	//Add items to menu
	for (udword i=0; i<m_carrayStringsList.Count(); i++)
	{
		m_button.GetMenu()->AddItem(m_carrayStringsList[i].Buffer(), i+1, 0);
	}

}
Beispiel #18
0
void NUseStoredOpsProp::Init()
{
	NObject* pobj;
	m_pvarBloc->GetValue(m_dwvarIdx, 0.0f, pobj);

	char* pszName="";

	//Display referenced object name (from varbloc)
	if (pobj)
	{
		NVarsBloc* pbloc = pobj->GetFirstVarsBloc();
		pbloc->GetValue(0, 0.0f, pszName);
	}

	//Create menu button
	m_button.Create(pszName, NRect(0,0,0,0), m_pParent, 0);
	m_button.OnChanged = FDelegate(this, (TDelegate)&NUseStoredOpsProp::OnValueChanged);

	//Buid menu's items
	NTreeNode* pnode = NEditorGUI::GetInstance()->GetAsset()->GetRootGroup();
	BuildMenu(pnode);
}
Beispiel #19
0
void
PaintBox::set_up_controls_()
{
	enum{ SPACE = 3, WIDTH = 120, HEIGHT = 17 };

	NLayout layout_0(this, 0, -1);
	layout_0.rest_rect().inset_by(SPACE, SPACE);

	{
		NLayout layout_1 = layout_0.split(WIDTH, NLayout::LEFT);

		NButton* button;
		NMessage* message;

		message = new NMessage(WM_COMMAND, IDM_EDIT_INSERT_FRAME, 0);
		button = new NButton(NRect(), "Insert", "Insert Frame", message);
		layout_1.add_child(button, HEIGHT);

		message = new NMessage(WM_COMMAND, IDM_EDIT_ERASE_FRAME, 0);
		button = new NButton(NRect(), "Erase", "Erase Frame", message);
		layout_1.add_child(button, HEIGHT);

		layout_0 = layout_0.split(layout_0.rest_rect().width() - WIDTH, NLayout::RIGHT);
		layout_0.rest_rect().left += SPACE;
	}

	{
		NLayout layout_1 = layout_0.split(WIDTH, NLayout::LEFT);

		NButton* button;
		NMessage* message;

		message = new NMessage(BRUSH_CHANGED);
		message->add_string("type", "flat1");
		button = new NButton(NRect(), "FlatBrush 1", "Flat Brush 1x1", message);
		button->set_target(this);
		layout_1.add_child(button, HEIGHT);

		message = new NMessage(BRUSH_CHANGED);
		message->add_string("type", "flat2");
		button = new NButton(NRect(), "FlatBrush 2", "Flat Brush 2x2", message);
		button->set_target(this);
		layout_1.add_child(button, HEIGHT);

		message = new NMessage(BRUSH_CHANGED);
		message->add_string("type", "flat3");
		button = new NButton(NRect(), "FlatBrush 3", "Flat Brush 3x3", message);
		button->set_target(this);
		layout_1.add_child(button, HEIGHT);

		message = new NMessage(BRUSH_CHANGED);
		message->add_string("type", "clone1");
		button = new NButton(NRect(), "CloneBrush 1", "Clone Brush 1x1", message);
		button->set_target(this);
		layout_1.add_child(button, HEIGHT);

		message = new NMessage(BRUSH_CHANGED);
		message->add_string("type", "clone3");
		button = new NButton(NRect(), "CloneBrush 3", "Clone Brush 3x3", message);
		button->set_target(this);
		layout_1.add_child(button, HEIGHT);

		message = new NMessage(BRUSH_CHANGED);
		message->add_string("type", "clone5");
		button = new NButton(NRect(), "CloneBrush 5", "Clone Brush 5x5", message);
		button->set_target(this);
		layout_1.add_child(button, HEIGHT);

		message = new NMessage(BRUSH_CHANGED);
		message->add_string("type", "eraser1");
		button = new NButton(NRect(), "Eraser 1", "Eraser 1x1", message);
		button->set_target(this);
		layout_1.add_child(button, HEIGHT);

		message = new NMessage(BRUSH_CHANGED);
		message->add_string("type", "eraser2");
		button = new NButton(NRect(), "Eraser 2", "Eraser 2x2", message);
		button->set_target(this);
		layout_1.add_child(button, HEIGHT);

		message = new NMessage(BRUSH_CHANGED);
		message->add_string("type", "eraser3");
		button = new NButton(NRect(), "Eraser 3", "Eraser 3x3", message);
		button->set_target(this);
		layout_1.add_child(button, HEIGHT);

		layout_0 = layout_0.split(layout_0.rest_rect().width() - WIDTH, NLayout::RIGHT);
		layout_0.rest_rect().left += SPACE;
	}

	{
		NLayout layout_1 = layout_0.split(WIDTH, NLayout::LEFT);

		NButton* button;
		NMessage* message;

		message = new NMessage(BRUSH_STROKE_CHANGED);
		message->add_string("type", "dot");
		button = new NButton(NRect(), "Dot Brush Stroke", "Dot Brush Stroke", message);
		button->set_target(this);
		layout_1.add_child(button, HEIGHT);

		message = new NMessage(BRUSH_STROKE_CHANGED);
		message->add_string("type", "line");
		button = new NButton(NRect(), "Line Brush Stroke", "Line Brush Stroke", message);
		button->set_target(this);
		layout_1.add_child(button, HEIGHT);

		layout_0 = layout_0.split(WIDTH, NLayout::RIGHT);
		layout_0.rest_rect().left += SPACE;
	}
}