Use undoview from deps/third_party/

    
BUG=111334
Review URL: https://chromiumcodereview.appspot.com/9293016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120056 0039d316-1c4b-4281-b951-d872f2087c98
parent dd54b3db
......@@ -310,6 +310,9 @@ deps = {
"src/third_party/libphonenumber/src/resources":
(Var("googlecode_url") % "libphonenumber") + "/trunk/resources@" +
Var("libphonenumber_revision"),
"src/third_party/undoview":
"/trunk/deps/third_party/undoview@119694",
}
......
This diff is collapsed.
Name: undoview
Short Name: undoview
URL: http://projects.gnome.org/gtksourceview, http://www.gtk.org
Version: unknown
License: LGPL 2.1
Security Critical: yes
This directory provides a new class, GtkUndoView. It is based on GtkTextView
from the GTK+ project, but with undo/redo support added. The code to add this
support is borrowed from the GtkSourceView project. Since GtkSourceView has a
lot of other stuff we don't want, we borrow only the undo/redo support and add
it to GtkTextView to create GtkUndoView.
This diff is collapsed.
/*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
* Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
* Copyright (C) 2002, 2003 Paolo Maggi
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef UNDOVIEW_UNDO_MANAGER_H_
#define UNDOVIEW_UNDO_MANAGER_H_
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define GTK_SOURCE_TYPE_UNDO_MANAGER (gtk_source_undo_manager_get_type())
#define GTK_SOURCE_UNDO_MANAGER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_SOURCE_TYPE_UNDO_MANAGER, GtkSourceUndoManager))
#define GTK_SOURCE_UNDO_MANAGER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GTK_SOURCE_TYPE_UNDO_MANAGER, GtkSourceUndoManagerClass))
#define GTK_SOURCE_IS_UNDO_MANAGER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_SOURCE_TYPE_UNDO_MANAGER))
#define GTK_SOURCE_IS_UNDO_MANAGER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GTK_SOURCE_TYPE_UNDO_MANAGER))
#define GTK_SOURCE_UNDO_MANAGER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), GTK_SOURCE_TYPE_UNDO_MANAGER, GtkSourceUndoManagerClass))
typedef struct _GtkSourceUndoManager GtkSourceUndoManager;
typedef struct _GtkSourceUndoManagerClass GtkSourceUndoManagerClass;
typedef struct _GtkSourceUndoManagerPrivate GtkSourceUndoManagerPrivate;
struct _GtkSourceUndoManager
{
GObject base;
GtkSourceUndoManagerPrivate *priv;
};
struct _GtkSourceUndoManagerClass
{
GObjectClass parent_class;
/* Signals */
void (*can_undo)(GtkSourceUndoManager *um, gboolean can_undo);
void (*can_redo)(GtkSourceUndoManager *um, gboolean can_redo);
};
GType gtk_source_undo_manager_get_type(void) G_GNUC_CONST;
GtkSourceUndoManager* gtk_source_undo_manager_new(GtkTextBuffer *buffer);
gboolean gtk_source_undo_manager_can_undo(const GtkSourceUndoManager *um);
gboolean gtk_source_undo_manager_can_redo(const GtkSourceUndoManager *um);
void gtk_source_undo_manager_undo(GtkSourceUndoManager *um);
void gtk_source_undo_manager_redo(GtkSourceUndoManager *um);
void gtk_source_undo_manager_begin_not_undoable_action(GtkSourceUndoManager *um);
void gtk_source_undo_manager_end_not_undoable_action(GtkSourceUndoManager *um);
gint gtk_source_undo_manager_get_max_undo_levels(GtkSourceUndoManager *um);
void gtk_source_undo_manager_set_max_undo_levels(GtkSourceUndoManager *um,
gint undo_levels);
G_END_DECLS
#endif // UNDOVIEW_UNDO_MANAGER_H_
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Boilerplate code was generated by http://burtonini.com/cgi/gobject.py
#include <gdk/gdkkeysyms.h>
#include "undo_view.h"
G_DEFINE_TYPE (GtkUndoView, gtk_undo_view, GTK_TYPE_TEXT_VIEW)
static void
gtk_undo_view_dispose(GObject *object) {
GtkUndoView *uview = GTK_UNDO_VIEW(object);
if(uview->undo_manager_) {
g_object_unref(G_OBJECT(uview->undo_manager_));
uview->undo_manager_ = NULL;
}
G_OBJECT_CLASS(gtk_undo_view_parent_class)->dispose(object);
}
static void
gtk_undo_view_undo(GtkUndoView *uview) {
if(gtk_source_undo_manager_can_undo(uview->undo_manager_))
gtk_source_undo_manager_undo(uview->undo_manager_);
}
static void
gtk_undo_view_redo(GtkUndoView *uview) {
if(gtk_source_undo_manager_can_redo(uview->undo_manager_))
gtk_source_undo_manager_redo(uview->undo_manager_);
}
static void
gtk_undo_view_class_init(GtkUndoViewClass *klass) {
GObjectClass *object_class = G_OBJECT_CLASS(klass);
GtkBindingSet *binding_set;
g_signal_new("undo",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET(GtkUndoViewClass, undo),
NULL,
NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
g_signal_new("redo",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET(GtkUndoViewClass, redo),
NULL,
NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
klass->undo = gtk_undo_view_undo;
klass->redo = gtk_undo_view_redo;
binding_set = gtk_binding_set_by_class(klass);
gtk_binding_entry_add_signal(binding_set, GDK_z, GDK_CONTROL_MASK, "undo", 0);
gtk_binding_entry_add_signal(binding_set, GDK_y, GDK_CONTROL_MASK, "redo", 0);
gtk_binding_entry_add_signal(binding_set, GDK_z, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "redo", 0);
gtk_binding_entry_add_signal(binding_set, GDK_F14, 0, "undo", 0);
object_class->dispose = gtk_undo_view_dispose;
}
static void
gtk_undo_view_init(GtkUndoView *self) {
}
GtkWidget*
gtk_undo_view_new(GtkTextBuffer *buffer) {
GtkWidget *ret = g_object_new(GTK_TYPE_UNDO_VIEW, "buffer", buffer, NULL);
GTK_UNDO_VIEW(ret)->undo_manager_ = gtk_source_undo_manager_new(GTK_TEXT_BUFFER(buffer));
return ret;
}
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Boilerplate code was generated by http://burtonini.com/cgi/gobject.py
#ifndef UNDOVIEW_UNDO_VIEW_H_
#define UNDOVIEW_UNDO_VIEW_H_
#include <gtk/gtk.h>
#include "undo_manager.h"
G_BEGIN_DECLS
#define GTK_TYPE_UNDO_VIEW gtk_undo_view_get_type()
#define GTK_UNDO_VIEW(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_UNDO_VIEW, GtkUndoView))
#define GTK_UNDO_VIEW_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_UNDO_VIEW, GtkUndoViewClass))
#define GTK_IS_UNDO_VIEW(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_UNDO_VIEW))
#define GTK_IS_UNDO_VIEW_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_UNDO_VIEW))
#define GTK_UNDO_VIEW_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_UNDO_VIEW, GtkUndoViewClass))
typedef struct {
GtkTextView parent;
GtkSourceUndoManager *undo_manager_;
} GtkUndoView;
typedef struct {
GtkTextViewClass parent_class;
void (*undo)(GtkUndoView *);
void (*redo)(GtkUndoView *);
} GtkUndoViewClass;
GType gtk_undo_view_get_type(void);
GtkWidget* gtk_undo_view_new(GtkTextBuffer *buffer);
G_END_DECLS
#endif // UNDOVIEW_UNDO_VIEW_H_
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'undoview',
'type': 'static_library',
'sources': [
'undo_manager.h',
'undo_manager.c',
'undo_view.h',
'undo_view.c',
],
'dependencies' : [
'../../build/linux/system.gyp:gtk',
],
},
],
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment