eek-preview.cpp revision 197a83914b869e636d779ab33d8e3371dc99d71c
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Eek Preview Stuffs.
*
* The Initial Developer of the Original Code is
* Jon A. Cruz.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <algorithm>
#include "eek-preview.h"
#include "preferences.h"
#define PRIME_BUTTON_MAGIC_NUMBER 1
#define FOCUS_PROP_ID 1
/* Keep in sycn with last value in eek-preview.h */
#define PREVIEW_SIZE_LAST PREVIEW_SIZE_HUGE
#define PREVIEW_MAX_RATIO 500
static GtkWidgetClass* parent_class = 0;
{
}
{
}
}
GType eek_preview_get_type(void)
{
static GType preview_type = 0;
if (!preview_type) {
static const GTypeInfo preview_info = {
sizeof( EekPreviewClass ),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof( EekPreview ),
0, /* n_preallocs */
NULL /* value_table */
};
preview_type = g_type_register_static( GTK_TYPE_DRAWING_AREA, "EekPreview", &preview_info, (GTypeFlags)0 );
}
return preview_type;
}
{
guint i = 0;
for ( i = 0; i < count; ++i ) {
if ( worked ) {
}
}
}
}
for ( i = 0; i < G_N_ELEMENTS(sizeThings); ++i ) {
}
}
{
if ( !setupDone ) {
GtkIconSize sizes[] = {
};
}
width *= 3;
}
if ( width < 0 ) {
width = 1;
}
}
}
#if GTK_CHECK_VERSION(3,0,0)
static void eek_preview_get_preferred_width(GtkWidget *widget, gint *minimal_width, gint *natural_width)
{
}
static void eek_preview_get_preferred_height(GtkWidget *widget, gint *minimal_height, gint *natural_height)
{
}
#endif
enum {
};
#if !GTK_CHECK_VERSION(3,0,0)
{
if (gtk_widget_is_drawable(widget)) {
}
return result;
}
#endif
{
insetTop = 1;
insetLeft = 1;
}
insetLeft = 1;
}
}
#if GTK_CHECK_VERSION(3,0,0)
cr,
0, 0,
cr,
0, 0,
#else
NULL,
NULL,
0, 0,
#endif
// Border
cairo_fill(cr);
}
cairo_rectangle(cr, insetLeft, insetTop, allocation.width - (insetLeft + insetRight), allocation.height - (insetTop + insetBottom));
cairo_fill(cr);
if ( preview->_previewPixbuf ) {
}
preview->_scaled = gdk_pixbuf_scale_simple(preview->_previewPixbuf, w - (insetLeft + insetRight), h - (insetTop + insetBottom), GDK_INTERP_BILINEAR);
}
// Border
cairo_fill(cr);
}
}
/* Draw arrow */
GdkRectangle possible = {insetLeft, insetTop, (allocation.width - (insetLeft + insetRight)), (allocation.height - (insetTop + insetBottom)) };
/* Make it square */
/* Center it horizontally */
}
#if GTK_CHECK_VERSION(3,0,0)
cr,
G_PI, // Down-pointing arrow
);
#else
NULL, /* clip area. &area, */
widget, /* may be NULL */
NULL, /* detail */
);
#endif
}
}
#if GTK_CHECK_VERSION(3,0,0)
cr,
G_PI, // Down-pointing arrow
);
#else
NULL, /* clip area. &area, */
widget, /* may be NULL */
NULL, /* detail */
);
#endif
}
}
#if GTK_CHECK_VERSION(3,0,0)
cr,
);
#else
NULL, /* clip area. &area, */
widget, /* may be NULL */
NULL, /* detail */
);
#endif
}
area.y,
}
#if GTK_CHECK_VERSION(3,0,0)
cr,
#else
NULL,
NULL,
#endif
}
area.y,
}
#if GTK_CHECK_VERSION(3,0,0)
cr,
NULL,
#else
NULL,
NULL,
#endif
}
}
if ( gtk_widget_has_focus(widget) ) {
#if GTK_CHECK_VERSION(3,0,0)
cr,
0 + 1, 0 + 1,
#else
NULL, /* GdkRectangle *area, */
NULL,
0 + 1, 0 + 1,
#endif
}
return FALSE;
}
{
}
return FALSE;
}
{
}
return FALSE;
}
/*
static gboolean eek_preview_focus_in_event( GtkWidget* widget, GdkEventFocus* event )
{
g_message("focus IN");
gboolean blip = parent_class->focus_in_event ? parent_class->focus_in_event(widget, event) : FALSE;
return blip;
}
static gboolean eek_preview_focus_out_event( GtkWidget* widget, GdkEventFocus* event )
{
g_message("focus OUT");
gboolean blip = parent_class->focus_out_event ? parent_class->focus_out_event(widget, event) : FALSE;
return blip;
}
*/
{
}
}
}
}
return FALSE;
}
{
if ( isAlt ) {
} else {
}
}
}
return FALSE;
}
{
switch ( property_id ) {
case FOCUS_PROP_ID:
{
}
break;
default:
{
if ( gobjClass->get_property ) {
}
}
}
}
{
switch ( property_id ) {
case FOCUS_PROP_ID:
{
}
}
break;
default:
{
if ( gobjClass->set_property ) {
}
}
}
}
{
/* g_message("Do the popup!"); */
return blip;
}
{
/*GtkObjectClass* objectClass = (GtkObjectClass*)klass;*/
/*objectClass->destroy = eek_preview_destroy;*/
/*widgetClass->map = ;*/
/*widgetClass->unmap = ;*/
/*widgetClass->realize = ;*/
/*widgetClass->unrealize = ;*/
#if GTK_CHECK_VERSION(3,0,0)
#else
#endif
/*widgetClass->size_allocate = ;*/
/*widgetClass->state_changed = ;*/
/*widgetClass->style_set = ;*/
/*widgetClass->grab_notify = ;*/
/*widgetClass->delete_event = ;*/
/*widgetClass->destroy_event = ;*/
/* widgetClass->key_press_event = eek_preview_key_press_event; */
/* widgetClass->key_release_event = eek_preview_key_release_event; */
/*widgetClass->configure_event = ;*/
/*widgetClass->focus_in_event = eek_preview_focus_in_event;*/
/*widgetClass->focus_out_event = eek_preview_focus_out_event;*/
/* selection */
/*widgetClass->selection_get = ;*/
/*widgetClass->selection_received = ;*/
/* drag source: */
/*widgetClass->drag_begin = ;*/
/*widgetClass->drag_end = ;*/
/*widgetClass->drag_data_get = ;*/
/*widgetClass->drag_data_delete = ;*/
/* drag target: */
/*widgetClass->drag_leave = ;*/
/*widgetClass->drag_motion = ;*/
/*widgetClass->drag_drop = ;*/
/*widgetClass->drag_data_received = ;*/
/* For keybindings: */
/*widgetClass->show_help = ;*/
/* Accessibility support: */
/*widgetClass->get_accessible = ;*/
/*widgetClass->screen_changed = ;*/
/*widgetClass->can_activate_accel = ;*/
g_signal_new( "clicked",
g_signal_new( "alt-clicked",
1, G_TYPE_INT );
"focus-on-click",
NULL,
"flag to grab focus when clicked",
TRUE,
)
);
}
{
}
}
{
}
{
return preview->_takesFocus;
}
{
}
}
void eek_preview_set_details( EekPreview* preview, PreviewStyle prevstyle, ViewType view, PreviewSize size, guint ratio, guint border )
{
if ( size > PREVIEW_SIZE_LAST ) {
}
if ( ratio > PREVIEW_MAX_RATIO ) {
}
}
{
/* gtk_widget_add_events( widg, GDK_ALL_EVENTS_MASK );*/
preview->_previewPixbuf = 0;
/*
GdkColor color = {0};
color.red = (255 << 8) | 255;
GdkColor whack = {0};
whack.green = (255 << 8) | 255;
gtk_widget_modify_bg( widg, GTK_STATE_NORMAL, &color );
gtk_widget_modify_bg( widg, GTK_STATE_PRELIGHT, &whack );
*/
/* GTK_STATE_ACTIVE, */
/* GTK_STATE_PRELIGHT, */
/* GTK_STATE_SELECTED, */
/* GTK_STATE_INSENSITIVE */
if ( 0 ) {
#if !GTK_CHECK_VERSION(3,0,0)
#endif
#if !GTK_CHECK_VERSION(3,0,0)
#endif
#if !GTK_CHECK_VERSION(3,0,0)
#endif
}
}
GtkWidget* eek_preview_new(void)
{
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :