Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow multiple row insertions in lists & trees

Fix an absolute path in Doxyfile
  • Loading branch information...
commit 898aa34da9da29719e0a989b0a523ccefde11178 1 parent 137175e
@jtappin jtappin authored
View
2  Doxyfile
@@ -110,7 +110,7 @@ WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
-INPUT = /home/vmagnin/Vincent IEMN/Interfaces graphiques/gtk-fortran/src
+INPUT = ${CMAKE_CURRENT_SOURCE_DIR}/src
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.c \
*.cc \
View
9 examples/hl_list_renderers.f90
@@ -314,12 +314,11 @@ program list_rend
& hl_gtk_cell_toggle, hl_gtk_cell_progress, hl_gtk_cell_pixbuf, &
& hl_gtk_cell_combo, hl_gtk_cell_radio /)
- ihlist = hl_gtk_listn_new(ihscrollcontain, types=ctypes, &
+ ihlist = hl_gtk_listn_new(types=ctypes, &
& changed=c_funloc(list_select),&
& multiple=TRUE, titles=titles, width=widths, &
& renderers=renderers, editable=editable, &
- & edited=c_funloc(cell_edited), hscroll_policy=GTK_POLICY_NEVER,&
- & vscroll_policy=GTK_POLICY_NEVER, toggled=c_funloc(cell_clicked), &
+ & edited=c_funloc(cell_edited), toggled=c_funloc(cell_clicked), &
& toggled_radio=c_funloc(rcell_clicked), &
& edited_combo=c_funloc(ccell_edit), &
& changed_combo=c_funloc(ccell_changed))
@@ -336,8 +335,8 @@ program list_rend
& data=c_loc(fmt_col(i)))
end do
! Now put <nrows> rows into it
+ call hl_gtk_listn_ins(ihlist, count=nrows)
do i=1,nrows
- call hl_gtk_listn_ins(ihlist)
write(line,"('List entry number ',I0)") i
ltr=len_trim(line)+1
line(ltr:ltr)=c_null_char
@@ -367,7 +366,7 @@ program list_rend
end do
! It is the scrollcontainer that is placed into the box.
- call hl_gtk_box_pack(base, ihscrollcontain)
+ call hl_gtk_box_pack(base, ihlist)
! Add a note about editable columns
lbl = gtk_label_new('The "Name", "N" and "Select?" columns are editable'&
View
4 examples/hl_tree.f90
@@ -186,9 +186,9 @@ program tree
! Add some child rows
do j = 2, 6, 2
+ call hl_gtk_tree_ins(ihlist, row = (/ j, -1_c_int /), count=5)
do i = 1, 5
- call hl_gtk_tree_ins(ihlist, row = (/ j, -1_c_int /))
- write(line,"('List entry number',I0,':',I0)") j,i
+ write(line,"('List entry number',I0,':',I0)") j+1,i
ltr=len_trim(line)+1
line(ltr:ltr)=c_null_char
call hl_gtk_tree_set_cell(ihlist, row=(/ j, i-1_c_int/), col=0_c_int, &
View
73 src/gtk-hl-tree-tmpl.f90
@@ -432,29 +432,41 @@ function hl_gtk_listn_new(scroll, ncols, types, changed, data, multiple,&
end function hl_gtk_listn_new
!+
- subroutine hl_gtk_listn_ins(list, row)
+ subroutine hl_gtk_listn_ins(list, row, count)
type(c_ptr), intent(in) :: list
- integer(kind=c_int), intent(in), optional :: row
-
+ integer(kind=c_int), intent(in), optional :: row, count
+
! Insert a row into a tabular list.
!
! LIST: c_ptr: required: The list into which to insert the row.
! ROW: c_int: optional: The row BEFORE which to insert the row
! (append if absent)
+ ! COUNT: c_int: optional: How many rows to add (default 1)
!-
type(c_ptr) :: store
type(gtktreeiter), target :: iter
+ integer(kind=c_int) :: i, n
! Get the ListStore
store = gtk_tree_view_get_model(list)
- ! Insert the row
+ if (present(count)) then
+ n = count
+ else
+ n = 1
+ end if
+
+ ! Insert the row(s)
if (present(row)) then
- call gtk_list_store_insert(store, c_loc(iter), row)
+ do i = 1, n
+ call gtk_list_store_insert(store, c_loc(iter), row)
+ end do
else
- call gtk_list_store_append(store, c_loc(iter))
+ do i = 1, n
+ call gtk_list_store_append(store, c_loc(iter))
+ end do
end if
end subroutine hl_gtk_listn_ins
@@ -1373,11 +1385,11 @@ function hl_gtk_tree_new(scroll, ncols, types, changed, data, multiple,&
end function hl_gtk_tree_new
!+
- subroutine hl_gtk_tree_ins(tree, row, absrow)
+ subroutine hl_gtk_tree_ins(tree, row, absrow, count)
type(c_ptr), intent(in) :: tree
integer(kind=c_int), intent(in), optional, dimension(:) :: row
- integer(kind=c_int), intent(in), optional :: absrow
+ integer(kind=c_int), intent(in), optional :: absrow, count
! Insert a row into a tabular tree.
!
@@ -1388,25 +1400,38 @@ subroutine hl_gtk_tree_ins(tree, row, absrow)
! top-level row use (/ 4, 1, -1 /).
! ABSROW: c_int: optional: The row BEFORE which to insert the new row
! treating the tree as a flat list.
+ ! COUNT: c_int: optional: How many rows to add (default 1)
!-
type(c_ptr) :: store
type(gtktreeiter), target :: iter1, iter2
integer(kind=c_int) :: valid
- integer :: i, ndep
+ integer :: i, ndep, n
+
+ if (present(count)) then
+ n = count
+ else
+ n = 1
+ end if
! Get the TreeStore
store = gtk_tree_view_get_model(tree)
! Insert the row (we don't use the "scanner" here because of the
! special case of -1 for append at a level).
+
if (present(row)) then
ndep = size(row)
if (ndep == 1) then
if (row(1) < 0) then
- call gtk_tree_store_append(store, c_loc(iter1), C_NULL_PTR)
+ do i = 1, n
+ call gtk_tree_store_append(store, c_loc(iter1), C_NULL_PTR)
+ end do
else
- call gtk_tree_store_insert(store, c_loc(iter1), C_NULL_PTR, row(1))
+ do i = 1, n
+ call gtk_tree_store_insert(store, c_loc(iter1), C_NULL_PTR, &
+ & row(1))
+ end do
end if
else
do i = 1, size(row)-1
@@ -1426,17 +1451,25 @@ subroutine hl_gtk_tree_ins(tree, row, absrow)
end do
call clear_gtktreeiter(iter1)
if (row(ndep) < 0) then
- call gtk_tree_store_append(store, c_loc(iter1), c_loc(iter2))
+ do i = 1, n
+ call gtk_tree_store_append(store, c_loc(iter1), c_loc(iter2))
+ end do
else
- call gtk_tree_store_insert(store, c_loc(iter1), &
- & c_loc(iter2), row(ndep))
+ do i = 1, n
+ call gtk_tree_store_insert(store, c_loc(iter1), &
+ & c_loc(iter2), row(ndep))
+ end do
end if
end if
else if (present(absrow)) then
if (absrow < 0) then
- call gtk_tree_store_append(store, c_loc(iter1), C_NULL_PTR)
+ do i = 1, n
+ call gtk_tree_store_append(store, c_loc(iter1), C_NULL_PTR)
+ end do
else if (absrow == 0) then
- call gtk_tree_store_prepend(store, c_loc(iter1), C_NULL_PTR)
+ do i = 1, n
+ call gtk_tree_store_prepend(store, c_loc(iter1), C_NULL_PTR)
+ end do
else
valid = hl_gtk_tree_abs_iter(tree, iter1, absrow)
if (valid == FALSE) then
@@ -1444,9 +1477,11 @@ subroutine hl_gtk_tree_ins(tree, row, absrow)
& "Row description does not point to an insertable location"
return
end if
- call clear_gtktreeiter(iter2)
- call gtk_tree_store_insert_before(store, c_loc(iter2), C_NULL_PTR, &
- & c_loc(iter1))
+ do i = 1, n
+ call clear_gtktreeiter(iter2)
+ call gtk_tree_store_insert_before(store, c_loc(iter2), &
+ & C_NULL_PTR, c_loc(iter1))
+ end do
end if
end if
end subroutine hl_gtk_tree_ins
View
75 src/gtk-hl-tree.f90
@@ -26,7 +26,7 @@
! --------------------------------------------------------
! gtk-hl-tree.f90
-! Generated: Fri Jan 18 17:40:21 2013 GMT
+! Generated: Tue Jan 22 21:40:12 2013 GMT
! Please do not edit this file directly,
! Edit gtk-hl-tree-tmpl.f90, and use ./mk_gtk_hl.pl to regenerate.
! Generated for GTK+ version: 2.24.0.
@@ -431,29 +431,41 @@ function hl_gtk_listn_new(scroll, ncols, types, changed, data, multiple,&
end function hl_gtk_listn_new
!+
- subroutine hl_gtk_listn_ins(list, row)
+ subroutine hl_gtk_listn_ins(list, row, count)
type(c_ptr), intent(in) :: list
- integer(kind=c_int), intent(in), optional :: row
-
+ integer(kind=c_int), intent(in), optional :: row, count
+
! Insert a row into a tabular list.
!
! LIST: c_ptr: required: The list into which to insert the row.
! ROW: c_int: optional: The row BEFORE which to insert the row
! (append if absent)
+ ! COUNT: c_int: optional: How many rows to add (default 1)
!-
type(c_ptr) :: store
type(gtktreeiter), target :: iter
+ integer(kind=c_int) :: i, n
! Get the ListStore
store = gtk_tree_view_get_model(list)
- ! Insert the row
+ if (present(count)) then
+ n = count
+ else
+ n = 1
+ end if
+
+ ! Insert the row(s)
if (present(row)) then
- call gtk_list_store_insert(store, c_loc(iter), row)
+ do i = 1, n
+ call gtk_list_store_insert(store, c_loc(iter), row)
+ end do
else
- call gtk_list_store_append(store, c_loc(iter))
+ do i = 1, n
+ call gtk_list_store_append(store, c_loc(iter))
+ end do
end if
end subroutine hl_gtk_listn_ins
@@ -1372,11 +1384,11 @@ function hl_gtk_tree_new(scroll, ncols, types, changed, data, multiple,&
end function hl_gtk_tree_new
!+
- subroutine hl_gtk_tree_ins(tree, row, absrow)
+ subroutine hl_gtk_tree_ins(tree, row, absrow, count)
type(c_ptr), intent(in) :: tree
integer(kind=c_int), intent(in), optional, dimension(:) :: row
- integer(kind=c_int), intent(in), optional :: absrow
+ integer(kind=c_int), intent(in), optional :: absrow, count
! Insert a row into a tabular tree.
!
@@ -1387,25 +1399,38 @@ subroutine hl_gtk_tree_ins(tree, row, absrow)
! top-level row use (/ 4, 1, -1 /).
! ABSROW: c_int: optional: The row BEFORE which to insert the new row
! treating the tree as a flat list.
+ ! COUNT: c_int: optional: How many rows to add (default 1)
!-
type(c_ptr) :: store
type(gtktreeiter), target :: iter1, iter2
integer(kind=c_int) :: valid
- integer :: i, ndep
+ integer :: i, ndep, n
+
+ if (present(count)) then
+ n = count
+ else
+ n = 1
+ end if
! Get the TreeStore
store = gtk_tree_view_get_model(tree)
! Insert the row (we don't use the "scanner" here because of the
! special case of -1 for append at a level).
+
if (present(row)) then
ndep = size(row)
if (ndep == 1) then
if (row(1) < 0) then
- call gtk_tree_store_append(store, c_loc(iter1), C_NULL_PTR)
+ do i = 1, n
+ call gtk_tree_store_append(store, c_loc(iter1), C_NULL_PTR)
+ end do
else
- call gtk_tree_store_insert(store, c_loc(iter1), C_NULL_PTR, row(1))
+ do i = 1, n
+ call gtk_tree_store_insert(store, c_loc(iter1), C_NULL_PTR, &
+ & row(1))
+ end do
end if
else
do i = 1, size(row)-1
@@ -1425,17 +1450,25 @@ subroutine hl_gtk_tree_ins(tree, row, absrow)
end do
call clear_gtktreeiter(iter1)
if (row(ndep) < 0) then
- call gtk_tree_store_append(store, c_loc(iter1), c_loc(iter2))
+ do i = 1, n
+ call gtk_tree_store_append(store, c_loc(iter1), c_loc(iter2))
+ end do
else
- call gtk_tree_store_insert(store, c_loc(iter1), &
- & c_loc(iter2), row(ndep))
+ do i = 1, n
+ call gtk_tree_store_insert(store, c_loc(iter1), &
+ & c_loc(iter2), row(ndep))
+ end do
end if
end if
else if (present(absrow)) then
if (absrow < 0) then
- call gtk_tree_store_append(store, c_loc(iter1), C_NULL_PTR)
+ do i = 1, n
+ call gtk_tree_store_append(store, c_loc(iter1), C_NULL_PTR)
+ end do
else if (absrow == 0) then
- call gtk_tree_store_prepend(store, c_loc(iter1), C_NULL_PTR)
+ do i = 1, n
+ call gtk_tree_store_prepend(store, c_loc(iter1), C_NULL_PTR)
+ end do
else
valid = hl_gtk_tree_abs_iter(tree, iter1, absrow)
if (valid == FALSE) then
@@ -1443,9 +1476,11 @@ subroutine hl_gtk_tree_ins(tree, row, absrow)
& "Row description does not point to an insertable location"
return
end if
- call clear_gtktreeiter(iter2)
- call gtk_tree_store_insert_before(store, c_loc(iter2), C_NULL_PTR, &
- & c_loc(iter1))
+ do i = 1, n
+ call clear_gtktreeiter(iter2)
+ call gtk_tree_store_insert_before(store, c_loc(iter2), &
+ & C_NULL_PTR, c_loc(iter1))
+ end do
end if
end if
end subroutine hl_gtk_tree_ins
Please sign in to comment.
Something went wrong with that request. Please try again.