Exemplo n.º 1
0
//---------------------------------------------------------
bool CMandelbrot::On_Execute_Position(CSG_Point ptWorld, TSG_Tool_Interactive_Mode Mode)
{
	double	d;

	switch( Mode )
	{
	default:
		break;

	case TOOL_INTERACTIVE_LDOWN:
	case TOOL_INTERACTIVE_RDOWN:
		GET_POS(m_Down);

		return( true );

	case TOOL_INTERACTIVE_LUP:
		GET_POS(m_Up);
		SET_POS(m_Up, m_Down);

		if( m_Up.Get_X() >= m_Down.Get_X() || m_Up.Get_Y() >= m_Down.Get_Y() )
		{
			m_Extent.Inflate(50.0);
			m_Extent.Move(m_Up - m_Extent.Get_Center());
		}
		else
		{
			m_Extent.Assign(m_Up, m_Down);
		}

		Calculate();

		return( true );

	case TOOL_INTERACTIVE_RUP:
		GET_POS(m_Up);
		SET_POS(m_Up, m_Down);

		if( m_Up.Get_X() >= m_Down.Get_X() || m_Up.Get_Y() >= m_Down.Get_Y() )
		{
			m_Extent.Deflate(50.0);
			m_Extent.Move(m_Up - m_Extent.Get_Center());
		}
		else
		{
			m_Extent.Deflate(100.0 * (m_Down.Get_X() - m_Up.Get_X()) / m_Extent.Get_XRange());
			m_Extent.Move(m_Up - m_Extent.Get_Center());
		}

		Calculate();

		return( true );
	}

	return( false );
}
Exemplo n.º 2
0
void cmd_goto_right(CmdContext *c, CmdParams *p)
{
	gint i;
	gint pos = p->pos;
	for (i = 0; i < p->num && pos < p->line_end_pos; i++)
		pos = NEXT(p->sci, pos);
	SET_POS(p->sci, pos, TRUE);
}
Exemplo n.º 3
0
void cmd_goto_left(CmdContext *c, CmdParams *p)
{
	gint i;
	gint start_pos = p->line_start_pos;
	gint pos = p->pos;
	for (i = 0; i < p->num && pos > start_pos; i++)
		pos = PREV(p->sci, pos);
	SET_POS(p->sci, pos, TRUE);
}
Exemplo n.º 4
0
void cmd_search_next(CmdContext *c, CmdParams *p)
{
	gboolean invert = FALSE;
	gint pos;

	if (p->last_kp->key == GDK_KEY_N)
		invert = TRUE;

	pos = perform_search(p->sci, c->search_text, p->num, invert);
	if (pos >= 0)
		SET_POS(c->sci, pos, TRUE);

}
Exemplo n.º 5
0
void cmd_goto_matching_brace(CmdContext *c, CmdParams *p)
{
	gint pos = p->pos;
	while (pos < p->line_end_pos)
	{
		gint matching_pos = SSM(p->sci, SCI_BRACEMATCH, pos, 0);
		if (matching_pos != -1)
		{
			SET_POS(p->sci, matching_pos, TRUE);
			return;
		}
		pos++;
	}
}
Exemplo n.º 6
0
static void find_char(CmdContext *c, CmdParams *p, gboolean invert)
{
	struct Sci_TextToFind ttf;
	gboolean forward;
	gint pos = p->pos;
	gint i;

	if (!c->search_char)
		return;

	forward = c->search_char[0] == 'f' || c->search_char[0] == 't';
	forward = !forward != !invert;
	ttf.lpstrText = c->search_char + 1;

	for (i = 0; i < p->num; i++)
	{
		gint new_pos;

		if (forward)
		{
			ttf.chrg.cpMin = NEXT(p->sci, pos);
			ttf.chrg.cpMax = p->line_end_pos;
		}
		else
		{
			ttf.chrg.cpMin = pos;
			ttf.chrg.cpMax = p->line_start_pos;
		}

		new_pos = SSM(p->sci, SCI_FINDTEXT, 0, (sptr_t)&ttf);
		if (new_pos < 0)
			break;
		pos = new_pos;
	}

	if (pos >= 0)
	{
		if (c->search_char[0] == 't')
			pos = PREV(p->sci, pos);
		else if (c->search_char[0] == 'T')
			pos = NEXT(p->sci, pos);
		SET_POS(p->sci, pos, TRUE);
	}
}
Exemplo n.º 7
0
static void search_current(CmdContext *c, CmdParams *p, gboolean next)
{
	gchar *word = get_current_word(p->sci);
	gint pos;

	g_free(c->search_text);
	if (!word)
		c->search_text = NULL;
	else
	{
		const gchar *prefix = next ? "/" : "?";
		c->search_text = g_strconcat(prefix, word, NULL);
	}
	g_free(word);

	pos = perform_search(p->sci, c->search_text, p->num, FALSE);
	if (pos >= 0)
		SET_POS(c->sci, pos, TRUE);

}
Exemplo n.º 8
0
void cmd_swap_anchor(CmdContext *c, CmdParams *p)
{
	gint anchor = c->sel_anchor;
	c->sel_anchor = p->pos;
	SET_POS(p->sci, anchor, TRUE);
}
Exemplo n.º 9
0
#define SET_POS(fun)\
    ARect rect = target()->geometry();\
    rect.set##fun(arg, point);\
    target()->setMinimumSize(QSize(0,0));\
    target()->setMaximumSize(QSize(16777215, 16777215));\
    target()->setGeometry(rect);\

#define MOVE_POS(fun)\
    ARect rect = target()->geometry();\
    rect.move##fun(arg);\
    target()->move(rect.topLeft());\

void AnchorsBase::setTop(int arg, Qt::AnchorPoint point)
{
    SET_POS(Top)
}

void AnchorsBase::setBottom(int arg, Qt::AnchorPoint point)
{
    SET_POS(Bottom)
}

void AnchorsBase::setLeft(int arg, Qt::AnchorPoint point)
{
    SET_POS(Left)
}

void AnchorsBase::setHorizontalCenter(int arg, Qt::AnchorPoint point)
{
    SET_POS(HorizontalCenter)
Exemplo n.º 10
0
void cmd_goto_column(CmdContext *c, CmdParams *p)
{
	gint pos = SSM(p->sci, SCI_FINDCOLUMN, p->line, p->num - 1);
	SET_POS(p->sci, pos, TRUE);
}