SECTION II : IMAGE SEARCHING AND SELECTION


2.1 Search Dialog

ImageDialog Class (derived from wxDialog)

Files: imagedialog.h   imagedialog.cpp
Authors: David Boys
Mike MacIntyre
Date: August 9, 2000
Technical
Advisor :
Carlos Moreno

           

Member

Purpose

 
wxTextCtrl * enter_box:  receives file specs for search
wxStaticText * preview_label: label for medium-sized image
 wxStaticText * filter_label:     label for wxChoice of filter
wxStaticText * file_label: label for enter_box
wxButton * ok_button  
wxButton * cancel_button  
PreviewPanel * preview:  preview image placed here
wxChoice * filter:  for filespec selection
FileCanvas * scroll_page: images found in search displayed here
wxTreeCtrl * tree: specific instances need to be defined by subclass
const wxString config_dir: stores path to applications setup directory
map <wxString, wxString> & icon_files: <path to real image, path to iconized image>
int config_icon_size: user selected size for iconized image
wxPanel * preview_info: holds the header and the label
wxStaticText * preview_info_label: displays width and height and byte size of preview image
wxStaticText * preview_info_header: header for preview_info_label
const wxString config_dir: allows access to configuration directory
const wxString map_filename allows retrieval and rewrite of file configured for map
vector <wxString> temp_selections: stores the images currently selected by user
vector <wxString> selected_files: stores the images selected by user after OK button press
map <wxString, wxString> icon_files:  associates path to original image with path to iconized image
int config_icon_size: size selected by user of the icons that appear after a successful search
wxString filespec_choices[CHOICE_SIZE]: choices that appear on the wxChoice control
wxString filespec_filters[CHOICE_SIZE]: specific filespecs associated with above choices
vector <wxString> panel_creation_files: holds the vector of filenames that results from a search
int panel_Y:  used to format panel placement on canvas
int panel_X:   used to format panel placement on canvas
int panel_counter:  used to format panel placement on canvas
int panels_per_column: used to format panel placement on canvas
int max_panel_width: used to format panel placement on canvas
wxTimer panel_timer: used instead of loop to create panels based on panel_creation_files vector

 

Function Definitions

ImageDialog::ImageDialog

Receive: wxWindow*, wxWindowID id, const wxString&, const wxPoint& const wxSize&, const wxString&, const wxString&, int
Return: N/A (constructor)
Description: Configures dialog box designed for image search
and selection.

 

ImageDialog::~ImageDialog

Receive: N/A (destructor)
Return: N/A (destructor)
Description: Deallocates memory.

 

ImageDialog::get_full_path

Receive: const wxTreeItemId&
Return: wxString
Description: returns the full path from the rootID of the
TreeCtrl to the ID received, separated by
forward slashes.

 

ImageDialog::enable_filespec_controls

Receive: void
Return: void
Description: Allows subclasses the option to use the controls
if desired.

 

ImageDialog::get_filespec

Receive: void
Return: wxString
Description: Returns the filespec associated with the wxChoice
item currently selected.

 

ImageDialog::init_filespec_choices

Receive: void
Return: void
Description: Sets up the association between the filters used
internally, and the choices offered to the end user

 

ImageDialog::set_tree_size_and_position

Receive: void
Return: void
Description: Places subclass defined tree in its alloted space

 

ImageDialog::ShowModal

Receive: void
Return: wxID_OK or wxID_CANCEL
Description: fill selected images (file paths) vector if OK button selected

 

ImageDialog::clear_preview

Receive: void
Return: void
Description: call public function of class Preview to remove
preview image from its panel.

 

ImageDialog::read_map_from_file

Receive: void
Return: void
Description: Reads into the original file/icon file map from a
configured file.

 

ImageDialog::write_map_to_file

Receive: void
Return: void
Description: Rewrites the original image filename / icon filename map to its file.

 

ImageDialog:: process_ok ()

Receive: void
Return: void
Description: Closes the dialog box returning code for OK button.

 

ImageDialog::max_length_of_labels

Receive: void
Return: integer
Description: Returns the width of the wider of the file label
and the filter label. Used in formatting the dialog.

 

ImageDialog::max_height_of_labels()

Receive: void
Return: integer
Description: Returns the height of the taller of the file label
and the filter label. Used in formatting the dialog.

 

ImageDialog::show_preview_info

Receive: const wxString & path, int h, int w, unsigned long size
Return: void
Description: Formats and sets the label that describes the preview, centered beneath the image.

 

ImageDialog::hide_preview_info

Receive: void
Return: void
Description: Removes text from label, and then makes label invisible.
This function is called internally whenever the actual
preview image is removed.

 

ImageDialog::clear_preview_info()

Receive: void
Return: void
Description: Cleans out the preview info label by drawing a rectangle that matches background colour in its alloted space.

 

ImageDialog::reverse_panel_creation_files()

Receive: void
Return: void
Description: Reverses the order of the vector of file paths that will
be used to create the icon image panels. Panels will then be created back to front, with the final file path in vector being removed (pop_back) at panel creation time.

 

ImageDialog::begin_panel_creation

Receive: void
Return: void
Description: Does the housekeeping necessary to begin a new image search and display.

 

ImageDialog::start_panel_timer()

Receive: void
Return: void
Description: Allows access to the timer.

 

ImageDialog::OnTimer

Receive: void
Return: void
Description: Triggered by timer event, adds the image corresponding to the last file path string to the file canvas, while ensuring that the search specifications have not changed in the meantime.

 

ImageDialog::get_temp_selections

Receive: void
Return: vector <wxString>
Description: Returns the vector of file paths currently highlighted
by the user.

 

ImageDialog::clear_panels()

Receive: void
Return: void
Description: Allows access for subclasses to remove existing panels from the canvas.

 

ImageDialog:: get_image_files()

Receive: void
Return: const vector<wxString> &
Description: Returns the vector of images selected by the user.

 

ImageDialog::text_box_value()

Receive: void
Return: const wxString
Description: Allows access to the contents of the text box.

 

ImageDialog::parse_textctrl

Receive: wxString & path, wxString & filespec
Return: void
Description: Divides the entry in the textcontrol into path and filespec, assigning them to the parameters received

 

ImageDialog::iconized_image_exists

Receive: const wxString& full_path
Return: bool
Description: Checks for existense of a map item pairing the full_path received with that of an iconized image. Returns true if match found.

 

ImageDialog::get_icon

Receive: wxImage* image, const wxString& full_path
Return: bool
Description: Attempts to load iconized image. Returns true if successful AND if iconized image is same as size most recently configured by end user.

 

ImageDialog::get_original_image

Receive: wxImage* image , wxString& full_path , bool & map_changed
Return: bool
Description: Loads an image and creates an icon for it. (adjusting map). Returns true if successful. Updates map_changed boolean if necessary.

 

ImageDialog::generate_filename

Receive: const wxString& full_path
Return: wxString
Description: Generates a unique filename based on the one received.


ImageDialog::iconize_image

Receive: wxImage* image, int max_size
Return: void
Description: Rescales image to a maximum width and height
while maintaining aspect ratio

 

ImageDialog::clear_text_box()

Receive: void
Return: void
Description: Allows access to the text control for clearing purposes.



FileCanvas Class (derived from wxScrolledWindow)

Parent: ImageDialog

Files: filecanvas.h filecanvas.cpp
Authors: David Boys
Mike MacIntyre
Date: August 9, 2000
Technical
Advisor :
Carlos Moreno

                   

Member

Purpose

 
vector<ImagePanel * > found_files: a vector of ImagePanel pointers
int config_icon_size: a system configured icon size
 PreviewPanel * preview: a pointer pointing to PreviewPanel class
vector <wxString> & temp_selections: a temp vector to store the selections made

Function Definitions


FileCanvas::FileCanvas

Receive: wxWindow *, wxWindowID, const wxPoint&, const wxSize&, int, vector <wxString> &, PreviewPanel *
Return: N/A (Constructor)
Description: Constructs a custom wxScrolledWindow

 

FileCanvas::~FileCanvas

Receive: N/A (Destructor)
Return: N/A (Destructor)
Description: Deallocates memory

 

FileCanvas::add_panel

Receive: const wxString &, const wxImage *, int, int
Return: void
Description: Instatiates a new ImagePanel adding it to the vector of ImagePanel pointers

 

FileCanvas::panel_width

Receive: int
Return: int
Description: Returns the width of the panel with the given
subscript

 

FileCanvas::setscrllba

Receive: int
Return: void
Description: Sets the scrollbar on the FileCanvas (wxScrolledWindow)

 

FileCanvas::clear_panels

Receive: void
Return:void
Return: Category *
Description: Returns a pointer to the Category Object containing all items in the CategoryTreeCtrl

 

CategoryTreeCtrl::modify_category

Receive: wxWindow * parent, const wxTreeItemId & selected_id
Return: void
Description: Allows user to modify the name of the Category Object associated with the given wxTreeItemId.

 

CategoryTreeCtrl::remove_category ()

Receive: wxWindow * parent, const wxTreeItemId & selected_id
Return: void
Description: Allows the user to remove the category object(and its sub-categories, if any) that is associated with the given wxTreeItemId. Displays a message box on the
parent window to the CategoryTreeCtrl object. Does not permit the user to remove the "root" category.

 

CategoryTreeCtrl::remove_file () const

Receive: const wxTreeItemId & selected_id
Return: void
Description: Allows the user to delete a file from the category object that is associated with the given wxTreeItemId. Displays a message box on the parent window to the CategoryTreeCtrl object.

 

CategoryTreeCtrl::update_category_file_contents

Receive: void
Return: void
Description: Writes information from Category objects contained in CategoryTreeCtrl to "categories" text file.

 

CategoryTreeCtrl::OnRightClick

Receive: wxMouseEvent& event
Return: void
Description: When user right-clicks on treectrl, pop-up menu to add, modify, or remove a category appears.


CategoryTreeCtrl::OnLeftClick

Receive: wxMouseEvent &event
Return: void
Description: When user selects an item on the treectrl, the coordinates of the position of the left-click are stored so that the pop-up menu appears in the correct location.

 

CategoryTreeCtrl::OnMenuAddCategory

Receive: wxMouseEvent& event
Return: void
Description: If user selects this item on pop-up menu, dialog appears to add a subcategory to the Category associated with the currently-selected item on treectrl.

 

CategoryTreeCtrl::OnMenuAddCategory

Receive: wxMouseEvent& event
Return: void
Description: If user selects this item on pop-up menu, dialog appears to remove the Category associated with currently-selected item on treectrl.

 

CategoryTreeCtrl::OnMenuAddCategory

Receive: wxMouseEvent& event
Return: void
Description: If user selects this item on pop-up menu, dialog appears to modify the Category associated with currently-selected item on treectrl.

 


Back