Ejemplo n.º 1
0
ReplaceEditParamDialog::ReplaceEditParamDialog(NCDialogParent *parent, ReplaceEditParams *params)
:	NCVertDialog(::createDialogAsChild, 0, parent, utf8_to_unicode(_LT("Replace")).ptr(), bListOkCancel),
	iL(16, 3),
	fromText(0, this, utf8_to_unicode(_LT("Search for:")).ptr()),
	toText(0, this, utf8_to_unicode(_LT("Replace with:")).ptr()),
	fromEdit	(0, this, 0, 0, 50),
	toEdit	(0, this, 0, 0, 50),
	caseButton(0, this, utf8_to_unicode(_LT("Case sensitive")).ptr(), 0, params->sens)
{
	if (params->from.ptr()) fromEdit.SetText(params->from.ptr(), true);
	if (params->to.ptr()) toEdit.SetText(params->to.ptr(), true);
	
	iL.AddWin(&fromText,	0, 0); fromText.Enable(); fromText.Show();
	iL.AddWin(&toText,	1, 0); toText.Enable(); toText.Show();
	
	iL.AddWin(&fromEdit,	0, 1); fromEdit.Enable(); fromEdit.Show(); 
	fromEdit.SetFocus();
	
	iL.AddWin(&toEdit,	1, 1); toEdit.Enable(); toEdit.Show(); 
	
	iL.AddWin(&caseButton, 2, 1); caseButton.Enable(); caseButton.Show(); 
	
	AddLayout(&iL);
	SetEnterCmd(CMD_OK);
	
	order.append(&fromEdit);
	order.append(&toEdit);
	order.append(&caseButton);
	
	SetPosition();
}
Ejemplo n.º 2
0
	CopyDialog(NCDialogParent *parent, bool move = false)
	:	SimpleCFThreadWin(parent, move ? _LT("Move") : _LT("Copy") ),
		_layout(7,2), 
		_text1(0, this, utf8_to_unicode(move ? _LT("Moving the file") : _LT("Copying the file") ).ptr()),
		_text2(0, this, utf8_to_unicode( _LT("to") ).ptr()),
		_text3(0, this, utf8_to_unicode( _LT("Files processed") ).ptr()),
		_from(this),
		_to(this),
		_countWin(this), 
		_progressWin(this)
	{
		_layout.AddWin(&_text1, 0, 0, 0, 1);
		_layout.AddWin(&_from, 1, 0, 1, 1);
		_layout.AddWin(&_text2, 2, 0, 2, 1);
		_layout.AddWin(&_to, 3, 0, 3, 1);
		_layout.AddWin(&_progressWin, 4,0,4,1);
		_layout.AddWin(&_text3, 5, 0);
		_layout.AddWin(&_countWin, 5, 1);
		_text1.Show(); _text1.Enable();
		_text2.Show(); _text2.Enable();
		_text3.Show(); _text3.Enable();
		_from.Show(); _from.Enable();
		_to.Show(); _to.Enable();
		_countWin.Show(); _countWin.Enable();
		_progressWin.Show(); _progressWin.Enable();
		AddLayout(&_layout);
		SetPosition();
	}
Ejemplo n.º 3
0
SearchFileParamDialog::SearchFileParamDialog(NCDialogParent *parent, SearchFileParams *params)
:	NCVertDialog(::createDialogAsChild, 0, parent, utf8_to_unicode(_LT("Search")).ptr(), bListOkCancel),
	iL(16, 3),
	maskText(0, this, utf8_to_unicode(_LT("File mask:")).ptr()),
	textText(0, this, utf8_to_unicode(_LT("Text:")).ptr()),
	maskEdit	(0, this, 0, 0, 50),
	textEdit	(0, this, 0, 0, 50),
	caseButton(0, this, utf8_to_unicode(_LT("Case sensitive")).ptr(), 0, params->sens)
{
	if (params->mask.ptr()) maskEdit.SetText(params->mask.ptr(), true);
	if (params->txt.ptr()) textEdit.SetText(params->txt.ptr(), true);
	
	iL.AddWin(&maskText,	0, 0); maskText.Enable(); maskText.Show();
	iL.AddWin(&textText,	1, 0); textText.Enable(); textText.Show();
	
	iL.AddWin(&maskEdit,	0, 1); maskEdit.Enable(); maskEdit.Show(); 
	maskEdit.SetFocus();
	
	iL.AddWin(&textEdit,	1, 1); textEdit.Enable(); textEdit.Show(); 
	
	iL.AddWin(&caseButton, 2, 1); caseButton.Enable(); caseButton.Show(); 
	
	AddLayout(&iL);
	SetEnterCmd(CMD_OK);
	
	order.append(&maskEdit);
	order.append(&textEdit);
	order.append(&caseButton);
	
	SetPosition();
}
Ejemplo n.º 4
0
void CharsetListWin::DrawItem(wal::GC &gc, int n, crect rect)
{
	if (cList && n >= 0 && n < cCount)
	{
		bool frame = false;
		
		UiCondList ucl;
		if ((n % 2)==0) ucl.Set(uiOdd, true);
		if (n == this->GetCurrent()) ucl.Set(uiCurrentItem, true);
		
		unsigned bg = UiGetColor(uiBackground, uiItem, &ucl, 0xFFFFFF);
		unsigned textColor = UiGetColor(uiColor, uiItem, &ucl, 0);
		unsigned frameColor = UiGetColor(uiFrameColor, uiItem, &ucl, 0);;

		if (n == this->GetCurrent())
			frame = true;
			
		gc.SetFillColor(bg);
		gc.FillRect(rect);
		gc.Set(GetFont());

		int x = 0;
		const unicode_t *txt = 0;

		gc.SetTextColor(textColor);
		gc.TextOutF(rect.left+10, rect.top+2, utf8_to_unicode(cList[n]->name).ptr());
		gc.TextOutF(rect.left+10+15*fontW, rect.top+2, utf8_to_unicode(cList[n]->comment).ptr() );
	} else {
		gc.SetFillColor(UiGetColor(uiBackground, uiItem, 0, 0xFFFFFF));
		gc.FillRect(rect);
	}
}
Ejemplo n.º 5
0
void KbIntCallback(
   const char* name, int name_len,
   const char* instruction, int instruction_len,
   int num_prompts,
   const LIBSSH2_USERAUTH_KBDINT_PROMPT* prompts,
   LIBSSH2_USERAUTH_KBDINT_RESPONSE* responses,
   void** anstract )
{
	if ( num_prompts <= 0 ) { return; }

	if ( !kbdIntInfo ) { return; }

	try
	{

		std::vector<FSPromptData> pData( num_prompts );
		int i;

		for ( i = 0; i < num_prompts; i++ )
		{
			pData[i].visible = prompts[i].echo != 0;
			pData[i].prompt = utf8_to_unicode( CopyToStrZ( prompts[i].text, prompts[i].length ).data() ).data();
		}

		static unicode_t userSymbol = '@';

		if ( !kbdIntInfo->Prompt(
		        utf8_to_unicode( "SFTP" ).data(),
		        carray_cat<unicode_t>( kbdIntParam->user.Data(), &userSymbol, kbdIntParam->server.Data() ).data(),
		        pData.data(), num_prompts ) ) { return; }

		for ( i = 0; i < num_prompts; i++ )
		{
			std::vector<char> str = new_char_str( ( char* )FSString( pData[i].prompt.Data() ).Get( kbdIntParam->charset ) );

			if ( str.data() )
			{
				int l = strlen( str.data() );
				responses[i].length = l;
				responses[i].text = ( char* ) malloc( l + 1 );

				if ( responses[i].text ) { strcpy( responses[i].text, str.data() ); }

			}
		}

	}
	catch ( cexception* ex )
	{
		fprintf( stderr, "exception in kbdint callback used with libssh2: %s\n", ex->message() );
		ex->destroy();
	}
	catch ( ... )
	{
		fprintf( stderr, "excention (...) in kbdint callback used with libssh2\n" );
	}
}
Ejemplo n.º 6
0
void clMenuData::Add( const char* utf8name, const char* utf8coment1, const char* utf8coment2, int cmd, int icon )
{
	Add( utf8name ? utf8_to_unicode( utf8name ).data() : 0,
	     utf8coment1 ? utf8_to_unicode( utf8coment1 ).data() : 0,
	     utf8coment2 ? utf8_to_unicode( utf8coment2 ).data() : 0,
	     cmd,
	     icon
	   );
}
Ejemplo n.º 7
0
	CharsetDlg1(NCDialogParent *parent, int curCharset)
	:	NCDialog(createDialogAsChild, 0, parent, utf8_to_unicode( _LT("Charset") ).ptr(), bListOkCancel), 
		layout(10,10),
		list(this, 7),
		otherButton(0, this, utf8_to_unicode( _LT("Other...") ).ptr(), CMD_OTHER),
		addButton(0, this, utf8_to_unicode( carray_cat<char>(_LT("Add..."), "(Ins)").ptr() ).ptr(), CMD_ADD),
		delButton(0, this, utf8_to_unicode( carray_cat<char>(_LT("Del..."), "(Del)").ptr() ).ptr(), CMD_DEL)
	{ 
		int i;

		InitOperCharsets();
		list.SetList(::csList.ptr(), ::csList.count());
		list.MoveFirst(0);

		for (int i = 0; i < ::csList.count(); i++) 
			if (::csList[i]->id == curCharset) {
				list.MoveCurrent(i);
				break;
			}
		
		/*
			LO
			L
			LA
			LD
		*/
		layout.AddWin(&list,0,0,3,0); list.Enable(); list.Show(); 
		list.SetFocus();
		layout.AddWin(&otherButton,0,1); otherButton.Enable(); otherButton.Show();
		layout.AddWin(&addButton,2,1); addButton.Enable(); addButton.Show();
		layout.AddWin(&delButton,3,1); delButton.Enable(); delButton.Show();

		int mx = 0, my = 0;
		LSize ls;

		otherButton.GetLSize(&ls); if (mx < ls.x.maximal) mx = ls.x.maximal; if (my < ls.y.maximal) my = ls.y.maximal;
		addButton.GetLSize(&ls); if (mx < ls.x.maximal) mx = ls.x.maximal;	if (my < ls.y.maximal) my = ls.y.maximal;
		delButton.GetLSize(&ls); if (mx < ls.x.maximal) mx = ls.x.maximal;	if (my < ls.y.maximal) my = ls.y.maximal;
		ls.x.minimal = ls.x.maximal = mx;
		ls.y.minimal = ls.y.maximal = my;
		otherButton.SetLSize(ls);
		addButton.SetLSize(ls);
		delButton.SetLSize(ls);

		layout.SetLineGrowth(1);

		AddLayout(&layout);
		SetEnterCmd(CMD_OK);
		SetPosition();
	};
Ejemplo n.º 8
0
CmdHistoryDialog::CmdHistoryDialog( int nId, NCDialogParent* parent, NCHistory& history )
	:  NCDialog( createDialogAsChild, nId, parent, utf8_to_unicode( " History " ).data(), bListOkCancel ),
	   _history( history ),
	   _selected( history.Count() - 1 ),
	   _list( Win::WT_CHILD, Win::WH_TABFOCUS | WH_CLICKFOCUS, 0, this, VListWin::SINGLE_SELECT, VListWin::BORDER_3D, 0 )
{
	for ( int i = _history.Count() - 1; i >= 0; i-- ) { _list.Append( _history[i] ); }

	_list.Enable();
	_list.Show();
	_list.SetFocus();
	LSRange h( 10, 1000, 10 );
	LSRange w( 50, 1000, 30 );
	_list.SetHeightRange( h ); //in characters
	_list.SetWidthRange( w ); //in characters

	if ( _history.Count() > 0 )
	{
		_list.MoveFirst( 0 );
		_list.MoveCurrent( _history.Count() - 1 );
	}


	AddWin( &_list );
	SetEnterCmd( CMD_OK );
	SetPosition();
};
Ejemplo n.º 9
0
bool Directory::open(const char * dirname)
{
    close();

    if (nullptr == dirname || '\0' == dirname[0])
    {
        return(false);
    }

    m_dir_name = dirname;
    if ('/' != *m_dir_name.rbegin() && '\\' != *m_dir_name.rbegin())
    {
        m_dir_name += g_directory_separator;
    }

#ifdef _MSC_VER
    std::wstring pattern(utf8_to_unicode(m_dir_name) + L"*");
    m_dir = FindFirstFileW(pattern.c_str(), &m_file);
    if (INVALID_HANDLE_VALUE == m_dir)
    {
        return(false);
    }
    m_eof = false;
#else
    m_dir = opendir(utf8_to_ansi(m_dir_name).c_str());
    if (nullptr == m_dir)
    {
        return(false);
    }
    m_file = readdir(m_dir);
#endif // _MSC_VER

    return(true);
}
Ejemplo n.º 10
0
/*
** Allocates new space for text buffer.
*/
void ocrwords_add_word(OCRWORDS *words,OCRWORD *word)

    {
    static char *funcname="ocrwords_add_word";
    int i;

    if (words->n>=words->na)
        {
        int newsize;
      
        newsize = words->na<512 ? 1024 : words->na*2;
        willus_mem_realloc_robust_warn((void **)&words->word,newsize*sizeof(OCRWORD),
                                    words->na*sizeof(OCRWORD),funcname,10);
        for (i=words->na;i<newsize;i++)
            ocrword_init(&words->word[i]);
        words->na=newsize;
        }
    words->word[words->n]=(*word);
    words->word[words->n].text=NULL;
    willus_mem_alloc_warn((void **)&words->word[words->n].text,strlen(word->text)+1,funcname,10);
    strcpy(words->word[words->n].text,word->text);
    /* Copy char positions */
    words->word[words->n].n=utf8_to_unicode(NULL,word->text,1000000);
    if (word->cpos!=NULL)
        {
        willus_mem_alloc_warn((void **)&words->word[words->n].cpos,
                       words->word[words->n].n*sizeof(double),funcname,10);
        for (i=0;i<words->word[words->n].n;i++)
            words->word[words->n].cpos[i] = word->cpos[i];
        }
    else
        words->word[words->n].cpos=NULL;
    words->n++;
    }
Ejemplo n.º 11
0
static int
do_op_right(struct form_state *fs, struct line_info *line, int current, int utf8)
{
	unsigned char *text, *end;
	int old_state;

	if (!utf8) {
		/* TODO: zle */
		fs->state = int_min(fs->state + 1, strlen(fs->value));
		return 0;
	}

	if (fs->state_cell) {
		fs->state_cell = 0;
		return 0;
	}

	text = fs->value + fs->state;
	end = strchr((const char *)text, '\0');
	old_state = fs->state;
	utf8_to_unicode(&text, end);

	fs->state = text - fs->value;

	if (old_state != fs->state && line[current].split_next) {
		fs->state_cell = (fs->state == line[current].end) ? old_state:0;
	} else if (!line[current].split_next) {
		fs->state_cell = 0;
	}

	return 0;
}
Ejemplo n.º 12
0
/*
 * updpos:
 *	update the position of the hardware cursor and handle extended
 *	lines. This is the only update for simple moves.
 */
void updpos(void)
{
	struct line *lp;
	int i;

	/* find the current row */
	lp = curwp->w_linep;
	currow = curwp->w_toprow;
	while (lp != curwp->w_dotp) {
		++currow;
		lp = lforw(lp);
	}

	/* find the current column */
	curcol = 0;
	i = 0;
	while (i < curwp->w_doto) {
		unicode_t c;
		int bytes;

		bytes = utf8_to_unicode(lp->l_text, i, curwp->w_doto, &c);
		i += bytes;
		if (c == '\t')
			curcol |= tabmask;

		++curcol;
	}

	/* if extended, flag so and update the virtual line image */
	if (curcol >= term.t_ncol - 1) {
		vscreen[currow]->v_flag |= (VFEXT | VFCHG);
		updext();
	} else
		lbound = 0;
}
Ejemplo n.º 13
0
/*
 * tiogetc:
 */
int tiogetc(void)
{
        static char buffer[32];
        static int pending;
        unicode_t c;
        int count, bytes = 1, expected;

        count = pending;

        if (!count) {
                count = read(0, buffer, sizeof(buffer));
                if (count <= 0)
                        return 0;
                pending = count;
        }


        c = (unsigned char )buffer[0];
        if (c >= 32 && c < 238)
                goto done;


        /* We need UTF8 sequences that start with 0xeo */
        expected = 2;
        if ((c & 0xe0) == 0xe0)
                expected = 6;

        if (count < expected) {
                int n;
                /* set timeout */
                new_termios.c_cc[VMIN] = 0;
                new_termios.c_cc[VTIME] = 1;
                tcsetattr(0, TCSANOW, &new_termios);

                n = read(0, buffer + count, sizeof(buffer) - count);

                /* unset timeout */
                new_termios.c_cc[VMIN] = 1;
                new_termios.c_cc[VTIME] = 0;
                tcsetattr(0, TCSANOW, &new_termios);

                if (n > 0)
                        pending += n;
        }

        if (pending > 1) {
                unsigned char second = buffer[1];

                /* XXX;  */
        }

        bytes = utf8_to_unicode(buffer, 0, pending, &c);

done:
        pending -= bytes;
        memmove(buffer, buffer+bytes, pending);
        return c;
}
Ejemplo n.º 14
0
void SysOptDialog::SetCurLang(const char *id)
{
	curLangId = new_char_str(id);
	if (id[0] == '-')
		langVal.SetText( utf8_to_unicode( _LT("English") ).ptr() );
	else if (id[0]=='+') 
		langVal.SetText( utf8_to_unicode( _LT("Autodetect") ).ptr() );
	else {
		for (int i = 0; i<list.count(); i++)
		{
			if (!strcmp(list[i].id.ptr(), id)) {
				langVal.SetText( utf8_to_unicode( list[i].name.ptr() ).ptr() );
				return;
			}
		}
		langVal.SetText( utf8_to_unicode( id ).ptr() );
	}
}
Ejemplo n.º 15
0
static void show_line(struct line *lp)
{
	int i = 0, len = llength(lp);

	while (i < len) {
		unicode_t c;
		i += utf8_to_unicode(lp->l_text, i, len, &c);
		vtputc(c);
	}
}
Ejemplo n.º 16
0
	clFileAssociationsWin( NCDialogParent* parent, std::vector<clNCFileAssociation>* Associations )
		: NCDialog( ::createDialogAsChild, 0, parent, utf8_to_unicode( _LT( "File associations" ) ).data(), bListOkCancel )
		, m_ListWin( this, Associations )
		, m_Layout( 10, 10 )
		, m_AddCurrentButton( 0, this, utf8_to_unicode( "+ (&Ins)" ).data(), CMD_PLUS )
		, m_DelButton( 0, this, utf8_to_unicode( "- (&Del)" ).data(), CMD_MINUS )
		, m_EditButton( 0, this, utf8_to_unicode( _LT( "&Edit" ) ).data(), CMD_EDIT )
		, m_Saved( true )
	{
		m_AddCurrentButton.Enable();
		m_AddCurrentButton.Show();
		m_DelButton.Enable();
		m_DelButton.Show();
		m_EditButton.Enable();
		m_EditButton.Show();

		LSize lsize = m_AddCurrentButton.GetLSize();
		LSize lsize2 = m_DelButton.GetLSize();
		LSize lsize3 = m_EditButton.GetLSize();

		if ( lsize.x.minimal < lsize2.x.minimal ) { lsize.x.minimal = lsize2.x.minimal; }

		if ( lsize.x.minimal < lsize3.x.minimal ) { lsize.x.minimal = lsize3.x.minimal; }

		if ( lsize.x.maximal < lsize.x.minimal ) { lsize.x.maximal = lsize.x.minimal; }

		m_AddCurrentButton.SetLSize( lsize );
		m_DelButton.SetLSize( lsize );
		m_EditButton.SetLSize( lsize );

		m_Layout.AddWinAndEnable( &m_ListWin, 0, 0, 9, 0 );
		m_Layout.AddWin( &m_AddCurrentButton, 0, 1 );
		m_Layout.AddWin( &m_DelButton, 1, 1 );
		m_Layout.AddWin( &m_EditButton, 2, 1 );
		m_Layout.SetLineGrowth( 9 );

		this->AddLayout( &m_Layout );

		SetPosition();

		m_ListWin.SetFocus();
		this->SetEnterCmd( CMD_OK );
	}
Ejemplo n.º 17
0
PanelOptDialog::PanelOptDialog(NCDialogParent *parent)
:	NCVertDialog(::createDialogAsChild, 0, parent, utf8_to_unicode( _LT( "Panel settings") ).ptr(), bListOkCancel),
	iL(16, 3),
	showHiddenButton(0, this, utf8_to_unicode( _LT("Show hidden files") ).ptr(), 0, wcmConfig.panelShowHiddenFiles),
	showIconsButton(0, this, utf8_to_unicode( _LT("Show icons") ).ptr(), 0, wcmConfig.panelShowIcons),
	caseSensitive(0, this, utf8_to_unicode( _LT("Case sensitive sort") ).ptr(), 0, wcmConfig.panelCaseSensitive)
{
	iL.AddWin(&showHiddenButton,	0, 0); showHiddenButton.Enable(); showHiddenButton.SetFocus(); showHiddenButton.Show(); 
	iL.AddWin(&showIconsButton,	1, 0); showIconsButton.Enable(); showIconsButton.Show(); 
	iL.AddWin(&caseSensitive,	2, 0); caseSensitive.Enable(); caseSensitive.Show(); 
	AddLayout(&iL);
	SetEnterCmd(CMD_OK);

	showHiddenButton.SetFocus();
	
	order.append(&showHiddenButton);
	order.append(&showIconsButton);
	order.append(&caseSensitive);
	SetPosition();
}
Ejemplo n.º 18
0
/* Calculates how much of string can be shown within the given maximum width
 * and sets trimmed parameter to non-zero value if all of string could not be
 * shown. If the reserve flag is true, it will reserve at least one
 * trailing character, which can be useful when drawing a delimiter.
 *
 * Returns the number of bytes to output from string to satisfy max_width. */
size_t
utf8_length(const char **start, int max_chars, size_t skip, int *width, size_t max_width, int *trimmed, bool reserve, int tab_size)
{
	const char *string = *start;
	const char *end = max_chars < 0 ? strchr(string, '\0') : string + max_chars;
	unsigned char last_bytes = 0;
	size_t last_ucwidth = 0;

	*width = 0;
	*trimmed = 0;

	while (string < end) {
		unsigned char bytes = utf8_char_length(string);
		size_t ucwidth;
		unsigned long unicode;

		if (string + bytes > end)
			break;

		/* Change representation to figure out whether
		 * it is a single- or double-width character. */

		unicode = utf8_to_unicode(string, bytes);
		/* FIXME: Graceful handling of invalid Unicode character. */
		if (!unicode)
			break;

		ucwidth = unicode_width(unicode, tab_size);
		if (skip > 0) {
			skip -= ucwidth <= skip ? ucwidth : skip;
			*start += bytes;
		}
		*width  += ucwidth;
		if (max_width > 0 && *width > max_width) {
			*trimmed = 1;
			*width -= ucwidth;
			if (reserve && *width == max_width) {
				string -= last_bytes;
				*width -= last_ucwidth;
			}
			break;
		}

		string  += bytes;
		if (ucwidth) {
			last_bytes = bytes;
			last_ucwidth = ucwidth;
		} else {
			last_bytes += bytes;
		}
	}

	return string - *start;
}
Ejemplo n.º 19
0
	GoToDialog( int nId, NCDialogParent* parent )
		:  NCVertDialog( ::createDialogAsChild, nId, parent, utf8_to_unicode( "Go to line" ).data(), bListOkCancel ), //0xD8E9EC, 0),
		   edit( 0, ( Win* )this, 0, 0 )
	{
		edit.Enable();
		edit.Show();
		AddWin( &edit );
		order.append( &edit );
		edit.SetFocus();
		SetPosition();
	}
Ejemplo n.º 20
0
	CopyDialog( NCDialogParent* parent, bool move = false )
		:  SimpleCFThreadWin( parent, move ? _LT( "Move" ) : _LT( "Copy" ) ),
		   _layout( 7, 2 ),
		   _text1( 0, this, utf8_to_unicode( move ? _LT( "Moving the file" ) : _LT( "Copying the file" ) ).data() ),
		   _text2( 0, this, utf8_to_unicode( _LT( "to" ) ).data() ),
		   _text3( 0, this, utf8_to_unicode( _LT( "Files processed" ) ).data() ),
		   _from( this ),
		   _to( this ),
		   _countWin( this ),
		   _progressWin( this ),
		   _speedStr( uiValue, this, 0, 0, StaticLine::LEFT, 10 ),
		   _lastMs( GetTickMiliseconds() )
	{
		_layout.AddWin( &_text1, 0, 0, 0, 1 );
		_layout.AddWin( &_from, 1, 0, 1, 1 );
		_layout.AddWin( &_text2, 2, 0, 2, 1 );
		_layout.AddWin( &_to, 3, 0, 3, 1 );
		_layout.AddWin( &_progressWin, 4, 0, 4, 1 );
		_layout.AddWin( &_text3, 5, 0 );
		_layout.AddWin( &_countWin, 5, 1 );
		_layout.AddWin( &_speedStr, 6, 0 );
		_text1.Show();
		_text1.Enable();
		_text2.Show();
		_text2.Enable();
		_text3.Show();
		_text3.Enable();
		_from.Show();
		_from.Enable();
		_to.Show();
		_to.Enable();
		_countWin.Show();
		_countWin.Enable();
		_progressWin.Show();
		_progressWin.Enable();
		_speedStr.Show();
		_speedStr.Enable();
		AddLayout( &_layout );
		SetTimer( 1, 1000 );
		SetPosition();
	}
Ejemplo n.º 21
0
bool stupid_set_current_work_directory(const std::string & dirname)
{
#ifdef _MSC_VER
    std::string platform_dirname(dirname);
    stupid_directory_format(platform_dirname);
    return(0 == _wchdir(utf8_to_unicode(platform_dirname).c_str()));
#else
    std::string platform_dirname(dirname);
    stupid_directory_format(platform_dirname);
    return(0 == chdir(utf8_to_ansi(platform_dirname).c_str()));
#endif // _MSC_VER
}
Ejemplo n.º 22
0
EditOptDialog::EditOptDialog(NCDialogParent *parent)
:	NCVertDialog(::createDialogAsChild, 0, parent, utf8_to_unicode( _LT("Editor") ).ptr(), bListOkCancel),
	iL(16, 2),

	saveFilePosButton(0, this, utf8_to_unicode( _LT("Save file position") ).ptr(), 0, wcmConfig.editSavePos),
	autoIdentButton(0, this, utf8_to_unicode( _LT("Auto indent") ).ptr(), 0, wcmConfig.editAutoIdent),
	shlButton(0, this, utf8_to_unicode( _LT("Syntax highlighting") ).ptr(), 0, wcmConfig.editShl),
	tabText(0, this, utf8_to_unicode( _LT("Tab size:") ).ptr()), 
	tabEdit(0, this, 0, 0, 16)
{
	char buf[0x100];
	snprintf(buf, sizeof(buf)-1, "%i", wcmConfig.editTabSize);
	tabEdit.SetText(utf8_to_unicode(buf).ptr(), true);

	iL.AddWin(&saveFilePosButton,	0, 0, 0, 1); saveFilePosButton.Enable(); saveFilePosButton.Show(); 
	iL.AddWin(&autoIdentButton,	1, 0, 1, 1); autoIdentButton.Enable(); autoIdentButton.Show(); 
	iL.AddWin(&shlButton,		2, 0, 2, 1); shlButton.Enable(); shlButton.Show(); 
	
	iL.AddWin(&tabText, 		3, 0, 3, 0); tabText.Enable(); tabText.Show();
	iL.AddWin(&tabEdit, 		4, 1, 4, 1); tabEdit.Enable(); tabEdit.Show(); 
	AddLayout(&iL);
	SetEnterCmd(CMD_OK);
	
	saveFilePosButton.SetFocus();
	
	order.append(&saveFilePosButton);
	order.append(&autoIdentButton);
	order.append(&shlButton);
	order.append(&tabEdit);
	SetPosition();
}
Ejemplo n.º 23
0
int RunDldMenu( int nUi, NCDialogParent* parent, const char* header, clMenuData* data )
{
	if ( !data || data->Count() <= 0 ) { return CMD_CANCEL; }

	NCDialog dlg( true, nUi, parent, utf8_to_unicode( header ).data(), 0 ); //, ::g_WcmConfig.whiteStyle ? 0xD8E9EC : 0xB0B000, 0xFFFFFF);
	clSelectDriveDlgMenu mtable( &dlg, data );
	mtable.Show();
	mtable.Enable();
	mtable.SetFocus();
	dlg.AddWin( &mtable );
	int Result = dlg.DoModal();
	return Result;
}
Ejemplo n.º 24
0
	clCreateDirDialog( NCDialogParent* Parent, bool IsMultipleFolders, const unicode_t* Str )
		: clInputStrDialogBase( Parent, utf8_to_unicode( _LT( "Create new directory" ) ).data() )
		, m_Layout( 2, 9 )
		, m_FieldEdit( EDIT_FIELD_MAKE_FOLDER, 0, (Win*)this, 0, 100, 7 )
		, m_MultipleButton( 1, this, utf8_to_unicode( _LT( "Process multiple folders" ) ).data(), 0, IsMultipleFolders )
	{
		m_Layout.AddWinAndEnable( &m_FieldEdit, 0, 0, 0, 2 );
		order.append( &m_FieldEdit );
		
		m_Layout.AddWinAndEnable( &m_MultipleButton, 1, 0, 1, 2 );
		order.append( &m_MultipleButton );
		
		AddLayout( &m_Layout );
		
		if ( Str )
		{
			m_FieldEdit.SetText( Str, true );
		}
		
		m_FieldEdit.SetFocus();
		SetPosition();
	}
Ejemplo n.º 25
0
	CfgLangDialog(NCDialogParent *parent, char *id, ccollect<LangListNode> *nl)
	:	NCDialog(createDialogAsChild, 0, parent, utf8_to_unicode( _LT("Language") ).ptr(), bListOkCancel), 
		_selected(0),
		_list(Win::WT_CHILD,Win::WH_TABFOCUS|WH_CLICKFOCUS, 0, this, VListWin::SINGLE_SELECT, VListWin::BORDER_3D, 0),
		nodeList(nl)
		
	{ 
		_list.Append( utf8_to_unicode( _LT("Autodetect") ).ptr()); //0
		_list.Append( utf8_to_unicode( _LT("English") ).ptr()); //1
		
		for (int i = 0; i<nl->count(); i++)
			_list.Append( utf8_to_unicode(nl->get(i).name.ptr()).ptr() );
			
		int cur = 0;
		if (id[0] == '+') cur = 0;
		else if (id[0] == '-') cur = 1;
		else {
			for (int i = 0; i<nl->count(); i++)
				if (!strcmp(id, nl->get(i).id.ptr()))
				{
					cur = i+2;
					break;
				}
		}
		_list.MoveCurrent(cur);
		
		_list.Enable();
		_list.Show();
		_list.SetFocus();
		LSRange h(10, 1000, 10);
		LSRange w(50, 1000, 30);
		_list.SetHeightRange(h); //in characters
		_list.SetWidthRange(w); //in characters
		
		AddWin(&_list);
		SetEnterCmd(CMD_OK);
		SetPosition();
	};
Ejemplo n.º 26
0
int main(int argc, char *argv[])
{
   // check arguments
    if (argc < 3)
    {
        // print out help topic

        std::cout << std::endl;
        std::cout << std::endl;
        std::cout << "-------------------------------------------------------------------------------" << std::endl;
        std::cout << "\t\tDoc/Docx file converter. Version: " << STRVER  << std::endl;
        std::cout << "-------------------------------------------------------------------------------" << std::endl;
        std::cout << std::endl;
        std::cout << "USAGE: ASCDocConverter \"path_to_file_1\" \"path_to_file_2\" " << std::endl;
        std::cout << "WHERE:" << std::endl;
        std::cout << "\t\"path_to_file_1\" is a path to file to be converted" << std::endl;
        std::cout << "\t\"path_to_file_2\" is a path to the corresponding output file" << std::endl << std::endl;
       return 1;
    }
    CString sArg1, sArg2, sExePath;

    sExePath    = utf8_to_unicode(argv [0]);
    sArg1       = utf8_to_unicode(argv [1]);
    sArg2       = utf8_to_unicode(argv [2]);


    CString sXMLOptions = _T("");

    {// doc->docx
        COfficeDocFile docFile;

        HRESULT hRes = docFile.LoadFromFile(sArg1, sArg2, sXMLOptions);

        if (hRes != S_OK)return 2;

    }
    return 0;
}
Ejemplo n.º 27
0
void ToolBar::AddCmd( int cmd, const char* tipText )
{
	if ( cmd != 0 )
	{
		clPtr<Node> p = new Node();
		p->cmd = cmd;

		if ( tipText && tipText[0] ) { p->tipText = utf8_to_unicode( tipText ); }

		p->icon = new cicon( cmd, _iconSize, _iconSize );
		_list.push_back( p );
		RecalcItems();
	}
}
Ejemplo n.º 28
0
static std::vector<unicode_t> ScanedDirString( const unicode_t* dirName )
{
	ccollect<unicode_t, 100> list;

	if ( dirName )
	{
		for ( int i = 0; i < 100 && *dirName; dirName++, i++ )
		{
			list.append( *dirName );
		}

		if ( *dirName )
		{
			list.append( ' ' );
			list.append( '.' );
			list.append( '.' );
			list.append( '.' );
		}
	}

	list.append( 0 );
	return carray_cat<unicode_t>( utf8_to_unicode( _LT( "Folder:" ) ).data(), utf8_to_unicode( " \"" ).data(), list.ptr(), utf8_to_unicode( "\"" ).data() );
}
Ejemplo n.º 29
0
TerminalOptDialog::TerminalOptDialog(NCDialogParent *parent)
:	NCVertDialog(::createDialogAsChild, 0, parent, utf8_to_unicode( _LT("Terminal options") ).ptr(), bListOkCancel),
	iL(16, 3),
	backspaceKeyStatic(0, this, utf8_to_unicode( _LT("Backspace key:") ).ptr()),
	backspaceAsciiButton(0, this, utf8_to_unicode("ASCII DEL").ptr(), 1, wcmConfig.terminalBackspaceKey == 0),
	backspaceCtrlHButton(0, this,  utf8_to_unicode("Ctrl H").ptr(), 1, wcmConfig.terminalBackspaceKey == 1)
{
	iL.AddWin(&backspaceKeyStatic,	0, 0, 0, 1 ); backspaceKeyStatic.Enable(); backspaceKeyStatic.Show(); 
	iL.AddWin(&backspaceAsciiButton,	1, 1); backspaceAsciiButton.Enable(); backspaceAsciiButton.Show(); 
	iL.AddWin(&backspaceCtrlHButton,	2, 1); backspaceCtrlHButton.Enable(); backspaceCtrlHButton.Show(); 

	iL.ColSet(0,10,10,10);
	iL.SetColGrowth(1);
	
	AddLayout(&iL);
	SetEnterCmd(CMD_OK);

	backspaceAsciiButton.SetFocus();
	
	order.append(&backspaceAsciiButton);
	order.append(&backspaceCtrlHButton);
	SetPosition();
}
Ejemplo n.º 30
0
void
new_pos(struct form_state *fs, struct line_info *line, int current, int max_cells)
{
	unsigned char *text = fs->value + line[current].start;
	unsigned char *end = fs->value + line[current].end;
	int cells = 0;

	while(cells < max_cells) {
		unicode_val_T data = utf8_to_unicode(&text, end);

		if (data == UCS_NO_CHAR) break;
		cells += unicode_to_cell(data);
	}
	fs->state = (int)(text - fs->value);
}