]> git.llucax.com Git - z.facultad/75.52/treemulator.git/commitdiff
Cuando agrego una clave la selecciono.
authorRicardo Markiewicz <rmarkie@fi.uba.ar>
Tue, 22 Nov 2005 17:04:25 +0000 (17:04 +0000)
committerRicardo Markiewicz <rmarkie@fi.uba.ar>
Tue, 22 Nov 2005 17:04:25 +0000 (17:04 +0000)
viewer/main.cpp

index 16f20e3a9c0d9813cb920eba897e7adfea21bb9c..aa0746aad58ca85123aa7ffd713ea6d07d95a1b2 100644 (file)
@@ -215,8 +215,28 @@ void agregar_clave ()
                        ClaveVariable c(str_key, atoi(str_val.c_str()));
                        tree->AddKey(c);
                }
-               delete tree->last_selected;
-               tree->AddNode (0);
+
+               /* Muestro la clave agregada */
+               BTreeFindResult* result = 0;
+               Clave *c = NULL;
+               if (tree->type() == BTree::KEY_FIXED) {
+                       c = new ClaveFija (atoi(str_key.c_str()), 0);
+                       result = tree->FindKey(*c);
+               } else {
+                       c = new ClaveVariable (str_key, 0);
+                       result = tree->FindKey(*c);
+               }
+               if (result) {
+                       tree->Clear ();
+                       tree->AddNode(result->node);
+                       tree->HighliteKey (*c);
+                       delete result;
+               } else {
+                       delete tree->last_selected;
+                       tree->last_selected = NULL;
+                       tree->AddNode (0);
+               }
+               if (c) delete c;
                real_canvas->scroll_to (0, 0);
        }
 }
@@ -246,7 +266,6 @@ void borrar_clave ()
                }
                delete tree->last_selected;
                tree->AddNode (0);
-               real_canvas->scroll_to (0, 0);
        }
 }