+- (IBAction)toggleWindow:(id)sender
+{
+ NSRect o_rect;
+ /*First, check if the playlist is visible*/
+ if ( [o_controller frame].size.height == [o_controller minSize].height )
+ {
+ /*Check if the stored heigth of the controller is usable (!= minSize)*/
+ if ([o_controller getSizeWithPlaylist].height !=
+ [o_controller minSize].height)
+ {
+ o_rect.size.height = [o_controller getSizeWithPlaylist].height;
+ }
+ else
+ {
+ /*If the stored height is not usable, use a reference one*/
+ o_rect.size.height = REF_HEIGHT;
+ }
+
+ /*Check if the controller width is the minimum one*/
+ if ( [o_controller frame].size.width == [o_controller minSize].width)
+ {
+ /*If the controller width is minimum, check if the stored height
+ of the playlist makes it visible*/
+ if ([o_controller getSizeWithPlaylist].height !=
+ [o_controller minSize].height)
+ {
+ o_rect.size.width = [o_controller getSizeWithPlaylist].width;
+ }
+ else
+ {
+ /*If not, use a reference width*/
+ o_rect.size.width = REF_WIDTH;
+ }
+ }
+ else
+ {
+ o_rect.size.width = [o_controller frame].size.width;
+ }
+ o_rect.origin.x = [o_controller frame].origin.x;
+ o_rect.origin.y = [o_controller frame].origin.y - o_rect.size.height +
+ [o_controller minSize].height;
+
+ [o_btn_playlist setState: YES];
+ }
+ else
+ {
+ o_rect.size = [o_controller minSize];
+ o_rect.origin.x = [o_controller frame].origin.x;
+ /*Calculate the position of the lower right corner after resize*/
+ o_rect.origin.y = [o_controller frame].origin.y +
+ [o_controller frame].size.height - [o_controller minSize].height;
+
+ [o_btn_playlist setState: NO];
+ }
+
+ [o_controller setFrame: o_rect display:YES animate: YES];
+}
+