moo_icon_view_activate_selected, moo_icon_view_move_cursor
parent
c3310605be
commit
849a39ad7b
40
moo.kdevelop
40
moo.kdevelop
|
@ -24,7 +24,7 @@
|
|||
</ignoreparts>
|
||||
<projectdirectory>.</projectdirectory>
|
||||
<absoluteprojectpath>false</absoluteprojectpath>
|
||||
<description/>
|
||||
<description></description>
|
||||
<secondaryLanguages>
|
||||
<language>C</language>
|
||||
</secondaryLanguages>
|
||||
|
@ -36,17 +36,17 @@
|
|||
<useconfiguration>debug</useconfiguration>
|
||||
</general>
|
||||
<run>
|
||||
<mainprogram>tests/editor</mainprogram>
|
||||
<mainprogram>tests/testfileview</mainprogram>
|
||||
<directoryradio>executable</directoryradio>
|
||||
<customdirectory>/</customdirectory>
|
||||
<programargs/>
|
||||
<programargs></programargs>
|
||||
<terminal>false</terminal>
|
||||
<autocompile>false</autocompile>
|
||||
<envvars/>
|
||||
</run>
|
||||
<configurations>
|
||||
<debug>
|
||||
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --disable-moo-module --without-python</configargs>
|
||||
<configargs>--enable-debug=full --enable-all-gcc-warnings=fatal --enable-developer-mode --disable-moo-module --without-python --without-mooapp --without-mooterm</configargs>
|
||||
<builddir>build/debug</builddir>
|
||||
<ccompiler>kdevgccoptions</ccompiler>
|
||||
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||
|
@ -54,13 +54,13 @@
|
|||
<cflags>-O0 -g3 -pg</cflags>
|
||||
<cxxflags>-O0 -g3 -pg</cxxflags>
|
||||
<envvars/>
|
||||
<topsourcedir/>
|
||||
<cppflags/>
|
||||
<ldflags/>
|
||||
<ccompilerbinary/>
|
||||
<cxxcompilerbinary/>
|
||||
<f77compilerbinary/>
|
||||
<f77flags/>
|
||||
<topsourcedir></topsourcedir>
|
||||
<cppflags></cppflags>
|
||||
<ldflags></ldflags>
|
||||
<ccompilerbinary></ccompilerbinary>
|
||||
<cxxcompilerbinary></cxxcompilerbinary>
|
||||
<f77compilerbinary></f77compilerbinary>
|
||||
<f77flags></f77flags>
|
||||
</debug>
|
||||
<optimized>
|
||||
<configargs>--enable-all-gcc-warnings=fatal --enable-developer-mode</configargs>
|
||||
|
@ -166,10 +166,10 @@
|
|||
<general>
|
||||
<dbgshell>libtool</dbgshell>
|
||||
<programargs>--g-fatal-warnings --sync</programargs>
|
||||
<gdbpath/>
|
||||
<configGdbScript/>
|
||||
<runShellScript/>
|
||||
<runGdbScript/>
|
||||
<gdbpath></gdbpath>
|
||||
<configGdbScript></configGdbScript>
|
||||
<runShellScript></runShellScript>
|
||||
<runGdbScript></runGdbScript>
|
||||
<breakonloadinglibs>true</breakonloadinglibs>
|
||||
<separatetty>false</separatetty>
|
||||
<floatingtoolbar>true</floatingtoolbar>
|
||||
|
@ -234,16 +234,16 @@
|
|||
</kdevdoctreeview>
|
||||
<kdevfilecreate>
|
||||
<filetypes>
|
||||
<type icon="source" ext="g" name="GAP source" create="template" >
|
||||
<type icon="source" ext="g" create="template" name="GAP source" >
|
||||
<descr>A new empty GAP source file</descr>
|
||||
</type>
|
||||
<type icon="source_cpp" ext="cpp" name="C++ Source" create="template" >
|
||||
<type icon="source_cpp" ext="cpp" create="template" name="C++ Source" >
|
||||
<descr>A new empty C++ file.</descr>
|
||||
</type>
|
||||
<type icon="source_h" ext="h" name="C/C++ Header" create="template" >
|
||||
<type icon="source_h" ext="h" create="template" name="C/C++ Header" >
|
||||
<descr>A new empty header file for C/C++.</descr>
|
||||
</type>
|
||||
<type icon="source_c" ext="c" name="C Source" create="template" >
|
||||
<type icon="source_c" ext="c" create="template" name="C Source" >
|
||||
<descr>A new empty C file.</descr>
|
||||
</type>
|
||||
</filetypes>
|
||||
|
@ -270,7 +270,7 @@
|
|||
</codecompletion>
|
||||
<references/>
|
||||
<creategettersetter>
|
||||
<prefixGet/>
|
||||
<prefixGet></prefixGet>
|
||||
<prefixSet>set</prefixSet>
|
||||
<prefixVariable>m_,_</prefixVariable>
|
||||
<parameterName>theValue</parameterName>
|
||||
|
|
|
@ -1280,7 +1280,8 @@ static int path_get_index (GtkTreePath *path)
|
|||
|
||||
|
||||
static Column *find_column_by_path (MooIconView *view,
|
||||
GtkTreePath *path)
|
||||
GtkTreePath *path,
|
||||
int *index)
|
||||
{
|
||||
GSList *l;
|
||||
int path_index;
|
||||
|
@ -1293,7 +1294,11 @@ static Column *find_column_by_path (MooIconView *view,
|
|||
int first = path_get_index (column->first);
|
||||
if (first <= path_index && path_index < first +
|
||||
num_entries (column))
|
||||
return column;
|
||||
{
|
||||
if (index)
|
||||
*index = path_index - first;
|
||||
return column;
|
||||
}
|
||||
}
|
||||
|
||||
g_return_val_if_reached (NULL);
|
||||
|
@ -1371,21 +1376,15 @@ static void rows_reordered (G_GNUC_UNUSED GtkTreeModel *model,
|
|||
|
||||
static void invalidate_cell_rect (MooIconView *view,
|
||||
Column *column,
|
||||
GtkTreePath *path)
|
||||
int index)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
int first, path_index;
|
||||
|
||||
if (view->priv->update_idle)
|
||||
return;
|
||||
|
||||
first = path_get_index (column->first);
|
||||
path_index = path_get_index (path);
|
||||
g_assert (first <= path_index);
|
||||
g_assert (path_index < first + num_entries (column));
|
||||
|
||||
rect.x = column->offset - view->priv->xoffset;
|
||||
rect.y = (path_index - first) * view->priv->layout->row_height;
|
||||
rect.y = index * view->priv->layout->row_height;
|
||||
rect.width = column->width;
|
||||
rect.height = view->priv->layout->row_height;
|
||||
|
||||
|
@ -1514,6 +1513,7 @@ static void invalidate_path_rectangle (MooIconView *view,
|
|||
GtkTreePath *path)
|
||||
{
|
||||
Column *column;
|
||||
int index;
|
||||
|
||||
if (view->priv->update_idle)
|
||||
return;
|
||||
|
@ -1521,9 +1521,9 @@ static void invalidate_path_rectangle (MooIconView *view,
|
|||
if (check_empty (view))
|
||||
return;
|
||||
|
||||
column = find_column_by_path (view, path);
|
||||
column = find_column_by_path (view, path, &index);
|
||||
g_return_if_fail (column != NULL);
|
||||
invalidate_cell_rect (view, column, path);
|
||||
invalidate_cell_rect (view, column, index);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1689,6 +1689,13 @@ GtkTreePath *moo_icon_view_get_path (MooIconView *view,
|
|||
}
|
||||
|
||||
|
||||
void moo_icon_view_activate_selected (MooIconView *view)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_ICON_VIEW (view));
|
||||
g_signal_emit (view, signals[ACTIVATE_SELECTED], 0);
|
||||
}
|
||||
|
||||
|
||||
static void activate_selected (MooIconView *view)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
|
@ -1774,24 +1781,6 @@ static GtkTreePath *get_path_at_cursor (MooIconView *view)
|
|||
}
|
||||
|
||||
|
||||
static int column_get_index (Column *column,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
int first, index;
|
||||
|
||||
g_return_val_if_fail (column != NULL, -1);
|
||||
g_return_val_if_fail (gtk_tree_path_get_depth (path) == 1, -1);
|
||||
|
||||
index = gtk_tree_path_get_indices(path)[0];
|
||||
first = gtk_tree_path_get_indices(column->first)[0];
|
||||
|
||||
g_return_val_if_fail (first <= index, -1);
|
||||
g_return_val_if_fail (index < first + num_entries (column), -1);
|
||||
|
||||
return index - first;
|
||||
}
|
||||
|
||||
|
||||
static GtkTreePath *column_get_path (Column *column,
|
||||
int index)
|
||||
{
|
||||
|
@ -1853,18 +1842,18 @@ static void move_cursor_right (MooIconView *view)
|
|||
|
||||
path = get_path_at_cursor (view);
|
||||
|
||||
column = find_column_by_path (view, path);
|
||||
column = find_column_by_path (view, path, &y);
|
||||
g_return_if_fail (column != NULL);
|
||||
|
||||
next = column_next (view, column);
|
||||
|
||||
if (!next)
|
||||
{
|
||||
moo_icon_view_select_path (view, path);
|
||||
move_cursor_to_entry (view, column,
|
||||
num_entries (column) - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
y = column_get_index (column, path);
|
||||
if (y >= num_entries (next))
|
||||
y = num_entries (next) - 1;
|
||||
move_cursor_to_entry (view, next, y);
|
||||
|
@ -1878,22 +1867,22 @@ static void move_cursor_left (MooIconView *view)
|
|||
{
|
||||
GtkTreePath *path;
|
||||
Column *column, *prev;
|
||||
int index;
|
||||
|
||||
if (check_empty (view))
|
||||
return;
|
||||
|
||||
path = get_path_at_cursor (view);
|
||||
|
||||
column = find_column_by_path (view, path);
|
||||
column = find_column_by_path (view, path, &index);
|
||||
g_return_if_fail (column != NULL);
|
||||
|
||||
prev = column_prev (view, column);
|
||||
|
||||
if (!prev)
|
||||
moo_icon_view_select_path (view, path);
|
||||
move_cursor_to_entry (view, column, 0);
|
||||
else
|
||||
move_cursor_to_entry (view, prev,
|
||||
column_get_index (column, path));
|
||||
move_cursor_to_entry (view, prev, index);
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
@ -1910,11 +1899,9 @@ static void move_cursor_up (MooIconView *view)
|
|||
|
||||
path = get_path_at_cursor (view);
|
||||
|
||||
column = find_column_by_path (view, path);
|
||||
column = find_column_by_path (view, path, &y);
|
||||
g_return_if_fail (column != NULL);
|
||||
|
||||
y = column_get_index (column, path);
|
||||
|
||||
if (y)
|
||||
{
|
||||
move_cursor_to_entry (view, column, y - 1);
|
||||
|
@ -1944,11 +1931,9 @@ static void move_cursor_down (MooIconView *view)
|
|||
|
||||
path = get_path_at_cursor (view);
|
||||
|
||||
column = find_column_by_path (view, path);
|
||||
column = find_column_by_path (view, path, &y);
|
||||
g_return_if_fail (column != NULL);
|
||||
|
||||
y = column_get_index (column, path);
|
||||
|
||||
if (y < num_entries (column) - 1)
|
||||
{
|
||||
move_cursor_to_entry (view, column, y + 1);
|
||||
|
@ -2062,6 +2047,26 @@ static void move_cursor_to_entry (MooIconView *view,
|
|||
}
|
||||
|
||||
|
||||
void moo_icon_view_move_cursor (MooIconView *view,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
Column *column;
|
||||
int index;
|
||||
|
||||
g_return_if_fail (MOO_IS_ICON_VIEW (view));
|
||||
|
||||
if (!path)
|
||||
return moo_icon_view_select_path (view, NULL);
|
||||
|
||||
g_return_if_fail (gtk_tree_path_get_depth (path) == 1);
|
||||
|
||||
column = find_column_by_path (view, path, &index);
|
||||
g_return_if_fail (column != NULL);
|
||||
|
||||
move_cursor_to_entry (view, column, index);
|
||||
}
|
||||
|
||||
|
||||
GtkTreePath *moo_icon_view_get_selected (MooIconView *view)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_ICON_VIEW (view), NULL);
|
||||
|
|
|
@ -103,6 +103,9 @@ GtkTreePath *moo_icon_view_get_path (MooIconView *view,
|
|||
int window_x,
|
||||
int window_y);
|
||||
GtkTreePath *moo_icon_view_get_selected (MooIconView *view);
|
||||
void moo_icon_view_activate_selected (MooIconView *view);
|
||||
void moo_icon_view_move_cursor (MooIconView *view,
|
||||
GtkTreePath *path);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in New Issue