X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbcrecentlist.C;h=d1e24349e654a8cfb7137064c7d8cf77fca1bc32;hp=8e1a61784970a4f499681e635c8f4d8ea0607dea;hb=7e5a0760f40ff787cc3d93cb7768a901ebe52809;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd diff --git a/cinelerra-5.1/guicast/bcrecentlist.C b/cinelerra-5.1/guicast/bcrecentlist.C index 8e1a6178..d1e24349 100644 --- a/cinelerra-5.1/guicast/bcrecentlist.C +++ b/cinelerra-5.1/guicast/bcrecentlist.C @@ -2,21 +2,21 @@ /* * CINELERRA * Copyright (C) 2004 Nathan Kurz - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * */ #include @@ -26,21 +26,22 @@ #include "bclistbox.h" #include "bclistboxitem.h" #include "bcrecentlist.h" +#include "language.h" // NOTE: textbox can be NULL if no textbox is associated -BC_RecentList::BC_RecentList(const char *type, BC_Hash *defaults, - BC_TextBox *textbox, int max, - int x, int y, int w, int h) - : BC_ListBox(x, y, w, h, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1) +BC_RecentList::BC_RecentList(const char *type, BC_Hash *defaults, + BC_TextBox *textbox, int max, + int x, int y, int w, int h) + : BC_ListBox(x, y, w, h, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1) { this->type = type; this->defaults = defaults; this->textbox = textbox; - set_tooltip("Choose from recently used"); + set_tooltip(_("Choose from recently used")); } -BC_RecentList::BC_RecentList(const char *type, BC_Hash *defaults, - BC_TextBox *textbox) +BC_RecentList::BC_RecentList(const char *type, BC_Hash *defaults, + BC_TextBox *textbox) : BC_ListBox(textbox->get_x() + textbox->get_w(), textbox->get_y(), textbox->get_w(), RECENT_POPUP_HEIGHT, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1) @@ -48,10 +49,10 @@ BC_RecentList::BC_RecentList(const char *type, BC_Hash *defaults, this->type = type; this->defaults = defaults; this->textbox = textbox; - set_tooltip("Choose from recently used"); + set_tooltip(_("Choose from recently used")); } -BC_RecentList::BC_RecentList(const char *type, BC_Hash *defaults) +BC_RecentList::BC_RecentList(const char *type, BC_Hash *defaults) : BC_ListBox(-1, -1, -1, -1, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1) { this->type = type; @@ -64,9 +65,10 @@ BC_RecentList::~BC_RecentList() items.remove_all_objects(); } -int BC_RecentList::handle_event() { +int BC_RecentList::handle_event() +{ BC_ListBoxItem *item = get_selection(0, 0); - if (item < 0) return 0; + if( !item ) return 0; char *text = item->get_text(); if (text && textbox) { // change the text in the textbox @@ -78,7 +80,8 @@ int BC_RecentList::handle_event() { } -int BC_RecentList::load_items(const char *prefix) { +int BC_RecentList::load_items(const char *prefix) +{ if (! prefix) prefix = "ANY"; @@ -101,13 +104,14 @@ int BC_RecentList::load_items(const char *prefix) { if (textbox) update(&items, 0, 0, 1); return count; -} +} -int BC_RecentList::add_item(const char *prefix, char *text) { +int BC_RecentList::add_item(const char *prefix, const char *text) +{ if (! prefix) prefix = "ANY"; - + // remove an old item if it matches the new text for (int i = 0; i < items.total; i++) { BC_ListBoxItem *item = items.values[i]; @@ -121,8 +125,8 @@ int BC_RecentList::add_item(const char *prefix, char *text) { // save up to maximum items of the list for future use int count; - for (count = 0; - count < RECENT_MAX_ITEMS && count < items.total; + for (count = 0; + count < RECENT_MAX_ITEMS && count < items.total; count++) { BC_ListBoxItem *item = items.values[count]; char save[BCTEXTLEN]; @@ -132,3 +136,4 @@ int BC_RecentList::add_item(const char *prefix, char *text) { return count; } +