Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc

Issue 165272: Add a first attempt at a compact location bar and a status bar. The status ba... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit.h ('k') | chrome/browser/defaults.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 9
10 #include "app/gfx/font.h" 10 #include "app/gfx/font.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 alignment_.Own(gtk_alignment_new(0., 0.5, 1.0, 0.0)); 133 alignment_.Own(gtk_alignment_new(0., 0.5, 1.0, 0.0));
134 134
135 // The GtkTagTable and GtkTextBuffer are not initially unowned, so we have 135 // The GtkTagTable and GtkTextBuffer are not initially unowned, so we have
136 // our own reference when we create them, and we own them. Adding them to 136 // our own reference when we create them, and we own them. Adding them to
137 // the other objects adds a reference; it doesn't adopt them. 137 // the other objects adds a reference; it doesn't adopt them.
138 tag_table_ = gtk_text_tag_table_new(); 138 tag_table_ = gtk_text_tag_table_new();
139 text_buffer_ = gtk_text_buffer_new(tag_table_); 139 text_buffer_ = gtk_text_buffer_new(tag_table_);
140 text_view_ = gtk_text_view_new_with_buffer(text_buffer_); 140 text_view_ = gtk_text_view_new_with_buffer(text_buffer_);
141 if (popup_window_mode_) 141 if (popup_window_mode_)
142 gtk_text_view_set_editable(GTK_TEXT_VIEW(text_view_), false); 142 gtk_text_view_set_editable(GTK_TEXT_VIEW(text_view_), false);
143 if (browser_defaults::kForceAutocompleteEditFontSize) { 143
144 // Until we switch to vector graphics, force the font size. 144 // Until we switch to vector graphics, force the font size.
145 const double kFontSize = 13.4; // 13.4px == 10pt @ 96dpi 145 gtk_util::ForceFontSizePixels(text_view_,
146 // On Windows, popups have a font size 5/6 the size of non-popups. 146 popup_window_mode_ ?
147 const double kPopupWindowFontSize = kFontSize * 5.0 / 6.0; 147 browser_defaults::kAutocompleteEditFontPixelSizeInPopup :
148 gtk_util::ForceFontSizePixels(text_view_, 148 browser_defaults::kAutocompleteEditFontPixelSize);
149 popup_window_mode_ ? kPopupWindowFontSize : kFontSize);
150 }
151 149
152 // The text view was floating. It will now be owned by the alignment. 150 // The text view was floating. It will now be owned by the alignment.
153 gtk_container_add(GTK_CONTAINER(alignment_.get()), text_view_); 151 gtk_container_add(GTK_CONTAINER(alignment_.get()), text_view_);
154 152
155 // TODO(deanm): This will probably have to be handled differently with the 153 // TODO(deanm): This will probably have to be handled differently with the
156 // tab to search business. Maybe we should just eat the tab characters. 154 // tab to search business. Maybe we should just eat the tab characters.
157 // We want the tab key to move focus, not insert a tab. 155 // We want the tab key to move focus, not insert a tab.
158 gtk_text_view_set_accepts_tab(GTK_TEXT_VIEW(text_view_), false); 156 gtk_text_view_set_accepts_tab(GTK_TEXT_VIEW(text_view_), false);
159 157
160 faded_text_tag_ = gtk_text_buffer_create_tag(text_buffer_, 158 faded_text_tag_ = gtk_text_buffer_create_tag(text_buffer_,
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 const std::string& selected_text) { 892 const std::string& selected_text) {
895 GtkClipboard* clipboard = 893 GtkClipboard* clipboard =
896 gtk_widget_get_clipboard(text_view_, GDK_SELECTION_PRIMARY); 894 gtk_widget_get_clipboard(text_view_, GDK_SELECTION_PRIMARY);
897 DCHECK(clipboard); 895 DCHECK(clipboard);
898 if (!clipboard) 896 if (!clipboard)
899 return; 897 return;
900 898
901 gtk_clipboard_set_text( 899 gtk_clipboard_set_text(
902 clipboard, selected_text.data(), selected_text.size()); 900 clipboard, selected_text.data(), selected_text.size());
903 } 901 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit.h ('k') | chrome/browser/defaults.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698