[GRASS-SVN] r33660 - grass/branches/develbranch_6/vector/v.digit
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Oct 3 04:33:12 EDT 2008
Author: marisn
Date: 2008-10-03 04:33:12 -0400 (Fri, 03 Oct 2008)
New Revision: 33660
Modified:
grass/branches/develbranch_6/vector/v.digit/settings.tcl
grass/branches/develbranch_6/vector/v.digit/toolbox.tcl
Log:
Add undo to add new column command in v.digit
Modified: grass/branches/develbranch_6/vector/v.digit/settings.tcl
===================================================================
--- grass/branches/develbranch_6/vector/v.digit/settings.tcl 2008-10-03 08:29:43 UTC (rev 33659)
+++ grass/branches/develbranch_6/vector/v.digit/settings.tcl 2008-10-03 08:33:12 UTC (rev 33660)
@@ -33,7 +33,7 @@
}
proc add_tab_col { name type width namedit typedit widthedit } {
- global tabrow columns table_frame
+ global tabrow columns table_frame iconpath
set row [ frame $table_frame.row$tabrow ]
set columns(frm,$tabrow) $row
@@ -41,6 +41,7 @@
set columns(name,$tabrow) $name
set columns(type,$tabrow) $type
set columns(width,$tabrow) $width
+ set columns(rem,$tabrow) 0
Entry $row.a -width 20 -textvariable columns(name,$tabrow) -bg white
if { $namedit == 0 } { $row.a configure -state disabled }
@@ -50,14 +51,25 @@
if { $typedit == 0 } { $row.b configure -state disabled }
Entry $row.c -width 10 -textvariable columns(width,$tabrow) -bg white
if { $widthedit == 0 } { $row.c configure -state disabled }
- set_col_type $tabrow
-
- pack $row.a $row.b $row.c -side left;
+ set_col_type $tabrow
+ Button $row.d -image [image create photo -file "$iconpath/remove.gif"] \
+ -borderwidth 1\
+ -command "rem_tab_col $row $tabrow"
+ if { $typedit == 0 } { $row.d configure -state disabled }
+
+ pack $row.a $row.b $row.c $row.d -side left;
pack $row -side top -fill x -expand no -anchor n
incr tabrow
}
+proc rem_tab_col { row num } {
+ global columns
+
+ set columns(rem,$num) 1
+ destroy $row
+}
+
proc table_buttons { } {
global table_page
set addcol [Button $table_page.addcol -text [G_msg "Add new column"] \
@@ -115,12 +127,14 @@
global tabrow columns create_table_err create_table_msg
set coldef ""
- for {set i 1} {$i < $tabrow} {incr i} {
- if { $i > 1 } { append coldef ", " }
- append coldef "$columns(name,$i) $columns(type,$i) "
- if { $columns(type,$i) == "varchar" } {
- append coldef "( $columns(width,$i) )"
- }
+ for {set i 1} {$i < $tabrow} {incr i} {
+ if { $columns(rem,$i) == 0 } {
+ if { $i > 1 } { append coldef ", " }
+ append coldef "$columns(name,$i) $columns(type,$i) "
+ if { $columns(type,$i) == "varchar" } {
+ append coldef "( $columns(width,$i) )"
+ }
+ }
}
puts $coldef
@@ -130,9 +144,9 @@
c_create_table $field $field_name $columns(name,1) $coldef
if { $create_table_err == 1 } {
- MessageDlg .msg -type ok -message $create_table_msg
+ MessageDlg .msg -icon error -parent .settings -type ok -message $create_table_msg
} else {
- MessageDlg .msg -type ok -message [G_msg "Table successfully created"]
+ MessageDlg .msg -icon info -parent .settings -type ok -message [G_msg "Table successfully created"]
clear_table
c_table_definition
}
Modified: grass/branches/develbranch_6/vector/v.digit/toolbox.tcl
===================================================================
--- grass/branches/develbranch_6/vector/v.digit/toolbox.tcl 2008-10-03 08:29:43 UTC (rev 33659)
+++ grass/branches/develbranch_6/vector/v.digit/toolbox.tcl 2008-10-03 08:33:12 UTC (rev 33660)
@@ -23,7 +23,7 @@
set prompt_right [G_msg "Right button"]
set coor ""
-wm title . "v.digit - $map_name@$map_mapset"
+wm title . "v.digit toolbox - $map_name@$map_mapset"
proc get_update_line {ox oy x y} {
.screen.canvas delete active
More information about the grass-commit
mailing list